Using Subversion to Seamlessly Update & Merge Web Sites and Web Applications

By Angsuman Chakraborty, Gaea News Network
Monday, January 15, 2007

I wanted a seamless procedure to update web sites and web applications without compromising security. The development server is under a firewall and so is the production server. Also the changes should be merged bi-directionally. I had few options like subversion or unison. I chose subversion because of greater familiarity and also because all of our source code is maintained in Subversion. Here are the simple steps which you too can use to keep your production and development server in sync.

The requirements are:
1. Subversion should be installed on both the machines
2. You should be able to allow certain IP addresses in your development server machine
3. Apache running on development server and configured to allow access to Subversion repository.*

*My development server runs Apache which is configured to allow access to Subversion repository. This is simple to setup and so I will not dwell upon it.

The firewall is configured separately for two subnets. The subnet identified as internet is not allowed to access any internal servers. However I added the IP address of my production server as a trusted host which essentially punched a hole in the firewall to allow my production server to access my development server.

With this simple setup all that is required is to checkout the files on the production server. I can make changes to the files from any development machines or even the production machine. After testing the files are committed and then the production server is updated with a single command (svn update).

BTW: If you are unfamiliar with Subversion you may find it easier to understand with my 5 minutes guide to subversion.

The downside of this approach is that subversion creates tons of files for its own use (in .svn directories) which consumes space and may create problems for web hosting palns with low disk space. For an alternative you can try using Unison.

Note: The security of the process can be further improved by transferring the data through ssh tunnel only.

Discussion
September 23, 2008: 12:13 pm

Instead of ’svn update’ use ’svn export’ to keep your production site up to date. This avoids the issues with SVN’s bookkeeping files like .svn.

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :