Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add droplet dns command to create DNS records #330

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

swalkinshaw
Copy link
Member

droplet dns will automatically create DNS records for all the hosts that exist on the wordpress site for an environment.

This includes multiple sites, canonical hosts, and all redirects. With a single command you can be sure that the DNS records are up to date and ready for SSL certificates as well.

Usage: trellis droplet dns [options] ENVIRONMENT

Creates DNS records for all WordPress sites' hosts in an environment.
DNS records (type A) will be created for each host that all point to the
server IP found in the environment's hosts file (eg: 'hosts/production');
the host IP can be manually overriden if need be.

-------------------------------------------------------------------------------
Note: this command assumes your domain's DNS is managed by DigitalOcean and the
nameservers have already been set to DigitalOcean's.

This command only supports Trellis' standard setup of one server per environment.
If your sites are split across multiple servers, then this command won't work and
you should manage your DNS manually.
-------------------------------------------------------------------------------

Using this wordpress_sites.yml config as an example:

  wordpress_sites:
    site1.com:
      site_hosts:
        - canonical: site1.com
          redirects:
            - www.site1.com
    site2.com:
      site_hosts:
        - canonical: site2.com
          redirects:
            - www.site2.com
        - canonical: different-site.com
          redirects:
            - www.different-site.com

The following hosts will have DNS A records created pointing to the production host IP:
  - site1.com
  - www.site1.com
  - site2.com
  - www.site2.com
  - different-site.com
  - www.different-site.com

Create DNS records for the production droplet:

  $ trellis droplet dns production

Force re-creation of existing DNS records:

  $ trellis droplet dns --force production

Manually specify the host IP to use:

  $ trellis droplet dns --ip 1.2.3.4 production

`droplet dns` will automatically create DNS records for all the hosts
that exist on the wordpress site for an environment.

This includes multiple sites, canonical hosts, and all redirects. With a
single command you can be sure that the DNS records are up to date and
ready for SSL certificates as well.
@swalkinshaw
Copy link
Member Author

@retlehs let me know what you think about the naming + command options

Copy link
Member

@retlehs retlehs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@swalkinshaw swalkinshaw merged commit f628988 into master Oct 27, 2022
@swalkinshaw swalkinshaw deleted the add-droplet-dns-command branch October 27, 2022 21:58
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants