Give Codeship’s CI/CD Platform a Try

Want to learn more?

At Codeship we always look into new ways how we can leverage Codeship to automate our workflows. A while ago we started Continuous Deployment of our DNS records.

How we managed our DNS records in the past.

Like everybody else – we used a web interface from our DNS provider. It’s basically a huge text area containing your zonefile. I always felt uncomfortable managing my DNS records this way. It’s too easy to delete a record by accident and nothing is preventing you from doing so.

What is missing in the old approach?

History

Reviews

My environment

History First and foremost, you don’t have a history of your zone. You can see and edit only the latest state of your zone. There is no way to see, why a record was added or deleted in your zone.

Reviews At Codeship we do code reviews for all our changes which go into our master branch. We all know a second pair of eyes is always better. Why not review changes which go into your DNS zone? I broke our DNS in the past, because of some stupid typo, which could have been prevented.

My environment Another reason which, in my opinion is the most underrated one, is that us developers live in our code. Moving out of my editor is a huge step, I don’t want to be forced to use something else than my trusted editor for coding.

How did we solve this?

History first. We are using Git (and GitHub) for all of our software projects and Git has proven that it can track changes very well. Using Git to track the history of our DNS zone feels natural.

How should we do reviews for our DNS zone? The same way we do reviews for our code. We are using the Pull-Request workflow already (read about it here). We love that workflow and we want to use it whenever possible.

You need a DNS provider who offers you an API to change your DNS records. We are using DNSimple (https://dnsimple.com/) as our DNS provider, because they offer a great API and 2-Factor-Authentication for your account.

It’s time to glue everything together. Git, Pull-Request and our DNS provider. We open sourced our solution. Feel free to use it! You can find it here: https://github.com/codeship/dns_deploy

Using Dnsdeploy with Codeship

We prepared an example repository to show how you can use dnsdeploy with Codeship. You can use this as a template for your DNS repository.

Conclusion

It’s amazing to review your DNS changes and track the history of your DNS zone with the tools you are familiar with.

Now I can simply open a Pull-Request on our DNS repository to propose changes. After somebody else in the team reviewed my changes they get merged into the master branch and, thanks to Codeship, immediately deployed.

The new workflow makes changes to our DNS zone transparent and comprehensible for everybody in the team. Who changed our SPF records lately? Now it’s simple to answer that question.

How do you manage your DNS records? I would love to learn about it in the comments.

Subscribe via Email

Over 60,000 people from companies like Netflix, Apple, Spotify and O'Reilly are reading our articles. Subscribe to receive a weekly newsletter with articles around Continuous Integration, Docker, and software development best practices.

We promise that we won't spam you. You can unsubscribe any time.

Join the Discussion

Leave us some comments on what you think about this topic or if you like to add something.