Automated deployment

Thursday, Jan 24 2013

Recently, I’ve had to work on an application where, for reasons that are best glossed over, a lot of the business logic resides in the Apache configuration.

This requires continuously updating a fairly complicated set of mod_rewrite configuration. The configuration needs to be installed on the test server and Apache itself restarted in order to test again.

This is not terribly time-consuming, but repeating the over and over can become wearisome and above all, tempt you to modify the Apache config in place instead of keeping all changes under version control.

Therefore I have spent some time with fabric, a handy Python library to ease the automation of secure shell (SSH) sessions.

Overall the process was straightforward. The only stumbling block was that I needed to specify the no shell option to the sudo command, since my user did not have the permission to use /bin/bash as root.

How much productivity did I gain? Did it repay the time invested in creating the script?. As always, these questions are difficult to answer. Having the script has affected my behaviour. Knowing that all I had to do was type a single command, I have become much more aggressive in deploying new changes to the test server. Therefore my overall development style changed considerably, and it is difficult to make a direct comparison in terms of time spent on the task.

What could be maybe compared more meaningfully is the number of accidents caused by Apache misconfiguration. We could check wheter their occurence has been reduced since the introduction of automation. Unfortunately, our sample (me) is much too small collect any significant statistics…