verify_dns_configuration
This module verifies the DNS resources required by the Smarter platform, in the cloud provider’s DNS.
- class smarter.apps.api.management.commands.verify_dns_configuration.Command(*args, **kwargs)[source]
Bases:
SmarterCommandManagement command for verifying the DNS resources required by the.
Smarter platform, in the cloud provider’s DNS, e.g. AWS Route53. The general structure of DNS for a Smarter installation is as follows:
example.com The root domain with hosted zone in AWS Route53 in the AWS account. This should have been created independently of this code base. This command will only verify that the Hosted Zone for the root domain exists. If it is missing then the command will fail.
[platform].example.com The platform domain with hosted zone in AWS Route53 in the AWS account and NS records in the root domain hosted zone delegating to it. This should have been created as part of the Terraform infrastructure provisioning for the platform. But if not, this command will create it and add the necessary NS records to the root domain hosted zone.
api.[platform].example.com The API domain for the platform with hosted zone in AWS Route53 in the AWS account and NS records in the platform domain hosted zone delegating to it. This should have been created as part of the Terraform infrastructure provisioning for the platform. But if not, this command will create it and add the necessary NS records to the platform domain hosted zone.
local.example.com The local proxy domain with hosted zone in AWS Route53 in the AWS account and NS records in the root domain hosted zone delegating to it.
api.local.example.com The local API proxy domain with hosted zone in AWS Route53 in the AWS account and NS records in the local proxy domain hosted zone delegating to it.
[alpha].[platform].example.com A non-production platform domain with hosted zone in AWS Route53 in the AWS account and NS records in the root domain hosted zone delegating to it.
[alpha].api.[platform].example.com A non-production API domain with hosted zone in AWS Route53 in the AWS account and NS records in the platform domain hosted zone delegating to it.
Usage:
This command is intended to be run during deployment, or in running installations as part of DNS trouble shooting. It is useful for administrators and DevOps engineers as an automated tool to validate and/or repair DNS infrastructure in AWS Route53 for the Smarter platform.
Error Handling and Output:
Raises clear exceptions and outputs descriptive error messages if any required DNS resource is missing or misconfigured.
Fails gracefully if the cloud provider is not configured, or its DNS service is not ready.
Reports the status of each verification and creation step, making it easy to identify and resolve issues.
See also
smarter.apps.infrastructure.services.dns.DNSService- the DNS service used for DNS operations.- get_any_A_record()[source]
A records all resolve to the same AWS Classic Load Balancer.
This is a simple traversal method to look for and retrieve an A record from the AWS Route53 hosted zone for any of the existing domains.
- Return type:
- get_load_balancer_a_record()[source]
Return the A record of the platform’s load balancer, to copy to the platform’s other domains.
This is the A record of the platform domain, e.g. platform.example.com. The root domain, e.g. example.com, is not necessarily served by the platform: it may be a marketing site behind a CDN. Its A record is used only when the platform domain does not yet have one, e.g. in a new installation.
- Returns:
the A record of the platform’s load balancer.
- Return type:
- Raises:
SmarterConfigurationError – if neither the platform domain nor the root domain has an A record.
- log_prefix = '\x1b[1;31msmarter.apps.api.management.commands.verify_dns_configuration.Command()\x1b[0m'
- verify_base_dns_config()[source]
Verify the DNS zones for domains associated with the.
Smarter platform. This includes any of the following domains depending on the configuration and the environment in which this command is being run:
example.com (root domain)
platform.example.com (platform domain)
api.platform.example.com (api domain)
local.example.com (local proxy domain)
api.local.example.com (local api proxy domain)
alpha.platform.example.com (non-production platform domain)
alpha.api.platform.example.com (non-production api domain)
- verify_domain_delegated_from_parent(child_domain, parent_domain, a_record)[source]
Verify the DNS zone for the child domain.
example: api.example.com
the zone for child_domain should exist.
the zone should contain an A record of the load balancer.
NS records for the child_domain zone should exist in the parent_domain zone.
- Parameters:
child_domain (
str) – the child domain to verify. example: api.example.comparent_domain (
str) – the parent domain that should have NS records delegating to the child domain. example: example.coma_record (
DNSRecord) – an A record to use for verification and creation if needed. This should be an A record alias to the AWS Classic Load Balancer that is serving traffic for the Sm
- Returns:
None
- verify_root_domain_dns_config()[source]
Verify the DNS zone for the root domain.
ie example.com - the zone for the root domain should exist. - the zone should contain an A record of the load balancer. - the zone should contain NS records for the root domain (as is expected for any zone).
- Returns:
None