Tag Archive for 'development'

24
Apr

Using Subversion for Web Development

Hopefully by now you know what Subversion, aka SVN, is. It’s a version control system that keeps track of changes made to files like source code and documentation. It’s similar to CVS, but with some major advantages. We’ve been using it at work for awhile, and I really like it. Changes don’t get lost, we can easily keep track of released versions, and once we get around to implementing it SVN will tie into our bug tracking system.

We usually have two servers for a project, one as the development server, and the other a production server. We all have a working copy checked out on the development server. Using virtual hosts with Apache we all have our own sub domain. So for example on our dev server we’d have:

  • dan.ourproject.com
  • mike.ourproject.com
  • jc.ourproject.com

… with each pointing to that developer’s working copy. We make our changes on the dev server as we’re making the site. When we finish a task we check it in, and everyone does an update often to avoid conflicts.

When we are getting ready to push a release out to the production server, we have to be careful since a lot of the time there are people using the site. We don’t want to have errors pop up on the production server. To make sure it runs on that server as well as it did in our working copies, we have a staging area. It’s on the same server as the production copy, but only we have access to it.

So we do an export to the staging area, click through the site and run through a checklist of things to check for. Once we’re sure it’s running ok we copy that to the production area and it’s live.

Since we want to keep track of the versions we push out to the production server, we give that release a version number, tag it in our Subversion repo, and update our project wiki.

This workflow has worked well for us and if we have a problem we can always roll back to a previous release. We can also use the Change Report feature of SmartSVN to do a kind of code review when others commit code. If we see something a little strange we can fix it, or if it’s completely crazy we can roll back quickly.

This is just how we do it. If you do it differently I’d love to hear about it so just leave a comment. In the future I’d also like to look into using Git in a similar way.