Skip to content

Don't break dns if an instance's base domain includes a subdomain part

Boros Gábor requested to merge omar/dns into master

Created by: omarkhan

Background

Sandboxes provisioned on stage.console.opencraft.com cannot be accessed by url, only by ip address. On investigation, it turns out that the dns records are being set incorrectly, as they ignore any part of the subdomain that has been set as part of the instance's base domain. For example:

The INSTANCES_BASE_DOMAIN setting is set to stage.opencraft.com. When a new instance is created with a subdomain of pr12338-2.sandbox, 3 gandi DNS records are added:

  • A: pr12338-2.sandbox.opencraft.com -> public IP
  • CNAME: preview-pr12338-2.sandbox.opencraft.com -> pr12338-2.sandbox.opencraft.com
  • CNAME: studio-pr12338-2.sandbox.opencraft.com -> pr12338-2.sandbox.opencraft.com

However, the instance expects to be reached at pr12338-2.sandbox.**stage.**opencraft.com.

Proposal

This pull request modifies OpenEdXInstance.set_appserver_active to use the tldextract package to correctly separate the subdomain from the base domain when adding DNS records.

Merge request reports