Using Subversion to Manage Development and Production

At my job I have recently setup an easy means of managing code as well as the whole chain of development. All without the need of giving developers direct login access to servers. Another bonus of using SVN is the ability to roll back changes in real time if needed. For our organization I have set up the following:

-Development environment consisting of a large server running OpenVZ ( I will write another entry soon on server virtualization) with images identical to the production servers. This allows the developers to have their own VPS (Virtual Private Server) to code and test on. All without fear of blowing it up. If this happens I simply type a total of 5 commands to destroy and rebuild the VPS.

-Staging environment consisting of a staging server that also hosts a stripped down data set of our production DBs. Here we have the development code that has made it to the point of being ready to be QA’d. All developers have access to Staging via SVN. They check out a working copy of the repository and work on it via their VPS or desktop. At the same time the /var/www of the Staging server itself is a checkout of the SVN repository. Using SVN hooks (namely post-commit) that once a commit is made it forces a svn update /var/www to insure that when a developer or client visit the staging site they see the changes.

-Finally there are the live web servers which have their own seperate repository where the QA person moves files from the staging working directory to the live working directory. Then does an add/commit.

All of this creates an audit trail of what has been pushed live and who/what changes were made. With our change request system each commit is refernced to its CR. So by viewing the SVN log for both staging and live you can see what is what. If a file pushed live has an issue you simple roll back to the previous version. There is no need to guess which files and if all were pushed to begin with.

I am very pleased with how this is working and the developers like it much more than our previous versioning system. For the Windows minded developers I have found Tortoise to be the easiest for them to use and understand.