Deploying website content via Subversion

Posted by Johann on Server Fault See other posts from Server Fault or by Johann
Published on 2012-06-19T08:50:31Z Indexed on 2012/06/19 9:18 UTC
Read the original article Hit count: 270

we have recently set up a new development infrastructure and process for one of our clients. This involves the strict use of subversion as a central source code repository. The svn repositories contains a seperate branch for code on the live system (/branches/live/). The repositories are use for PHP content (mainly Wordpress Blogs), but in future they may hold other asp code as well. Bonus points for a solutions which more or less in the same way with ASP code on Windows Server 2008 R2.

We have two servers: one staging system and one live system. The staging system is updated regularly with the code of the trunk. The live system is update manually. Each webroot on the servers are working copy of either the trunk (staging system) or the live branch (live system).

The current workflow is:

Developing on the dev's box -> commit into the trunk -> auto-deploy on staging system -> testing on the staging system -> merging into /branches/live/ -> manual deployment on live system.

This works for one-way changes very well, however we have some troubles on every wordpress (or plugin) update: The WP update process removes the directories and unpack the archive of the new version. This removes the svn admin area as well, which produces a lot of errors. We could switch to SVN 1.7 with a single, global admin area, but this would only solve on part of the problem.

Finally, we have done the update via the WP Gui, restored the svn admin area, added/removed the files and committed the changes to the trunk. After testing, we had to do basically the same thing on the live server (except the commit, we just reverted the changes and merged the new files from the staging system to the live system).

I'm currently thinking of the following:

  • The htdocs of each website is a svn export
  • Each website has a svn working copy beside the htdocs directory
  • a script which "replays" the changes in the wc from htdocs after an update in WP (rsync'ing the changed files to the working copy, rsync'ing new files and svn add them and finally svn delete the deleted files). The script would have to exclude some files (like wp-config.php, uploads/temp directories, etc.).

Are there better ways to do this? Unfortunaly, a complete CI server is out of scope due to time and budget limitations.

© Server Fault or respective owner

Related posts about centos

Related posts about windows-server-2008-r2