Sunday 28 October 2012

This is Automation Sparta - Wildcard DNS

This post is the 3rd in a set of posts outlining Automation Sparta - a No Configuration setup for Web Development.

In this post I'll talk about the power of wildcard DNS and how you can use it to reduce configuration time in your web deployment.

In web development there are typically at least 3 environments (servers) in your Project Universe. Dev, Staging (QA), Live (Production). To test a web application we obviously need a domain to hit for each environment.

Some agencies use:
something-dev.yourcompany.com
something-staging.yourcompany.com
something-live.yourcompany.com

Some use:
something.yourcompanydev.com
something.yourcompanystaging.com
something.yourcompanylive.com

Others use:
something.dev.yourcompany.com
something.staging.yourcompany.com
something.live.yourcompany.com

Note: "something" is typically be a project code or project name.

Actually, to be honest, I've never seen an agency that has it's own Live domain. They typically wait until the client tells them what they want the live domain to be. This means that they often get as far as Staging in  deployment. They never reach a deployment to the Live environment until very late in the development cycle. This is a horrible horrible horrible practice! Anyway, let's pretend that all agencies have the good practice of testing their new websites on the live server even before the client tells them the desired domain...

If you take a look at the 2nd and 3rd example, you can see that for each project (web application) the only part of the domain that will change will be the prefix. This is where wildcard DNS can be applied. 

All you need to do is register the following wildcards with your DNS provider:

*.dev.yourcompany.com
*.staging.yourcompany.com
*.live.yourcompany.com

Just make sure that each wildcard points to the respective server. Now any prefix can be used for each environment. For example. thisissomethingrandom.dev.yourcompany.com will automatically point to your development environment.

The benefit of this is obvious. It removes the need for configuration of DNS for each project. You can just deploy your site to the respective server. All you need to do is create an IIS site. And this can be automated! This also means that you can deploy to your Live server early in the development process without having to wait for the client to register a domain (which seems to normally happen late in the game). These are 2 crucial components to a "no configuration" setup.
As an added bonus, you'll also notice that many software licenses are valid for sub-domains. This means that you can use the same license file for each environment. Of course you may still need a new license for the actual live domain. But at least you can still test your site on the live server before the real domain is registered/available.


Anyway, if your DNS provider does not support wildcard DNS then you definitely consider changing providers. Wildcard DNS is a massive time saver. It is just another DNS entry. It shouldn't cost you anything extra. For more information about wildcard DNS click here.

No comments:

Post a Comment