Our UI team was recently in a position where our development process was holding up rapid deployments. We would schedule what we thought was a week’s worth of work at the beginning of the week and aim to deploy it to production at the end of the week. We continually found ourselves in a situation where something that got checked into trunk (we use SVN) was not able to be released, either because of a bug caught during testing or because the feature was not ready to go out to production across the entire platform. This lead to big scary releases once everything was ready.
We worked on all features in branches, but in order to test in our integration environment, we would merge the feature to trunk and deploy. If the feature had bugs we couldn’t release trunk and if trunk had bugs we couldn’t release the feature. Neither was a desirable scenario. We took a look at our requirements and came up with a solution that would allow us to deploy code whenever we needed – bug fix releases could go out everyday and feature release could go out as soon as they were ready.
Our main requirement was that we had to be able to push our code to our sandbox environment for testing. We would never know if a feature worked across the entire platform unless we tested it in our sandbox. We needed to be able to have multiple branches in our sandbox, all accessible at the same time. The next production release can always be found at http://dw.sand-08.adnxs.net and the in-progress features can be found at http://feature.dw.sand-08.adnxs.net, for example.
To achieve this we started doing all of our work in branches. Nothing could get checked in to trunk unless there was no doubt that it could be released to production at any moment. Each branch would get built into an RPM by Maestro (our internal deployment application) and deployed to our sandbox at /var/html/feature-a or /var/html/feature-b depending on the branch name we created. We then used Apache’s VirtualDocumentRoot directive instead of DocumentRoot, added a wildcard DNS entry for *.dw.sand-08.adnxs.net and were on our way to rapid deployments to both our sandbox and production.
For those interested in how VirtualDocumentRoot was used in our Apache configs, we removed DocumentRoot and added the line:
The “%1″ matches “feature-a” in http://feature-a.dw.sand-08.adnxs.net uses /var/html/feature-a/www as the document root. Pretty cool and just what we were looking for.