I’m a huge fan of Subversion (aka svn) becuase it’s a robust and easy to use version control system and, well to be honest, I never really got on all that well with CVS. After 2 years developing on Macs, I’m now back using a PC to build the BeGrand.net site. On the Mac eveything was very easy, svn was built in, and the wonderful Coda supported it out of the box from version 1.5 onwards. There are lots of different ways that you can setup SVN to control code within your projects and in this post I’m going to explain a very simple methodology that seems to work really well for me.
Installing SVN
On Windows you have to download the subversion binaries and then choose a suitable client. I settled on TortoiseSVN mainly because of the tight Windows Explorer integration. I won’t go into too much detail on the isntallation becuase there are many very good tutorials available online.
Hosting your code
The next thing you need is an SVN repository (aka repo) to store your project. I use an externally hosted SVN repo from BeanStalk becuase:
- I like to have my source code backed up externally and securely (as well as my TimeCapsule iDisk, local drive backup and an external drive backup!)
- I can grant access to anyone I need to
- It’s reliable and secure
- It integrates nicely with several other platforms I use (like Basecamp)
- It supports secure deployment via sftp
A little about my setup
I’m developing on my desktop with Apache, MySQL and PHP installed locally. When I’ve finished initial development and preliminary testing, I copy the file to a development server on our network so everyone else can see the changes and test as well. Once we’re happy with the build, I commit the changes to our svn repo. This triggers an sftp deployment to our development server in the Amazon EC2 cloud. Beanstalk allows you to trigger an automatic update on every commit or manage the process manually (deploying a build or specific file).
The description of the deployment process from ther Beanstalk website:
The deployment tool is more like a synchronization rather than an upload. To maintain bandwidth and speed, Beanstalk syncs files based on the revision that you choose to deploy. Deployments are published in several ways.
- Automatically on each commit (if specified)
- By going to the Releases tab (paid accounts only) and clicking deploy (all files in your repo from that revision are included)
By using the tags [deploy:development], [deploy:staging], or [deploy:production] in your commit message.
As our development progresses the ability to choose a server to deploy to via the commit message is going to be a very valuable and time saving tool.
Incidentally, I made the diagram using LovelyCharts, which is nice.
{ 3 comments… read them below or add one }
Great stuff! Would be interested to know how you set up SFTP with Subversion in a future blog post.
HI, Mike, glad to hear about BeGrand and interested to read your posts. Just a note to say the piccie of the setup doesn't quite match the description. I think you need to change a couple of labels; local server -> test server, test server -> Development server (cloud).
P.S I also got bitten by PHP short tags when setting up a XAMPP for straight-street.com
Steve Lee
OSS Watch – open source advisory service
Full Measure – open accessibility
Maavis – simple access to computers, media and communications
How did you get Beanstalk to sftp into Amazon EC2, ie where do you specify amazon's private key?