Roll your own Subversion server

Why?

There are dozens of Subversion hosts out there but in my opinion, the pricing has always been too high for what they offer. In a world where you can get a VPS on the Rackspace Cloud for around $11 a month, $15 for just Subversion with user and repository limits makes no sense.

Well it turns out you can run your own Subversion server easily with their svnserve deamon. Even cooler, is that there exists an open source app called Warehouse which lets you access your SVN repository via the web. Not only does it look cool and has features on par with paid hosting services, but it also lets you administer svnserve through their interface, thus eliminating one of the woes of rolling your own Subversion. With one of the low priced servers offered by Cloud VPS providers, you can set up your own tailored Subversion system at a fraction of the cost.

That being said, there are some exceptions. If your Subversion needs are all public/open source repositories, Google Code is tough to beat at the price of free. If you don’t have the patience or desire to manage your own server, Beanstalk provides an excellent service with many cool features and options.

How?

Deploying, Installing, and Configuring a VPS isn’t easy. Even less so when the app you are trying to run is written in Ruby on Rails. But that is what is great about Cloud VPS services. You deploy a server, tinker with it, screw it up beyond belief, and at the end of the day you can simply delete it and start again.

Well I can’t think of how many guides helped me deploy my own servers, so I thought I’d give back with my own tutorial that incorporates it all into a deployable system that can help many starting developers out there. Read on and you will learn how to deploy not only a measly Subversion server, but a Ruby on Rails web stack as well, all on a small 256 MB VPS instance.

Where?

There are plenty of Cloud VPS providers out there. Off the top of my head, there’s Slicehost, Linode, Rackspace Cloud, and A Small Orange. The guide can certainly be adapted to a provider of your choosing, but I’ve picked a 256 MB instance on the Rackspace Cloud since they are the cheapest of the group. They sell bandwidth instead of bundling it which is useful at these traffic levels. They are also oriented towards short term deployments so it is conductive to testing on a clone of your slice rather than attempting changes on your production server.

It might be worth noting that Slicehost was purchased by Rackspace a while back so they use the same hardware and VPS images so their guides are interchangeable. Slicehost’s are prettier so that is why I’ve linked to those instead.

OS-Wise, I’m sure this works on any distro out there, but keep in mind this guide is written for CentOS 5.3 so all the nuances described here might only apply to this OS flavor. If the commands don’t work line for line and you are on Ubuntu server, it might be different folder layouts or who knows what. I recommend CentOS if you have a choice of distro.

Software-stack-wise, I’ve chosen the following based on actual testing, optimization, and ease of deployment on a 256 MB slice:

  • Subversion with svnserve for repository access.
  • Warehouse for web repository access.
  • Ruby on Rails powered by a Thin web server cluster.
  • Nginx web server for static requests.
  • MySQL as the backend database.

When?

Over the next couple of days I’ll post each part of the guide. I’ve divided things into three logical sub-guides as follows:

  1. Set up Cloud Server, OS, and deploy Web Stack.
  2. Initialize your repository and get svnserve up and running.
  3. Download, install, and initialize Warehouse.
  4. Configure svnserve and add Repositories to Warehouse.
  5. Create post-commit hooks and automate access files.

Let’s get started!

Tags: , , ,


  • Thanks for posting this! There are lots of resources out there but yours is the one that put me over the edge. I just instantiated my Rackspace Cloud server yesterday and I already have my small web site and svn host going. Between your text and the links to Slicehost's pages I didn't have much trouble getting things going. I haven't put Warehouse on there yet but it's not as urgent because I am currently the only user of the repo... but that will change! Thanks again.

    One observation. Even though Slicehost has been bought by Rackspace Cloud, Slicehost's pricing is a little different. I found that Slicehost's monthly rates are higher---but those rates include a block of bandwidth. In contrast, Rackspace's monthly rates are lower, but no bandwidth is included in that price. Since I couldn't figure out how much Slicehost charges for extra bandwidth, I was kind of stuck making a comparison. Ultimately I decided that I'd probably come out ahead with Rackspace for a little while, at least.
  • Hey, thanks for the comments. Regarding bandwidth, Slicehost charges $0.30/GB of overage bandwidth with 100 GB base while RackSpace charges $0.22/GB from the start.

    From my calculations back when I started, you can get a RackSpace Cloud 256MB slice with 40 GB of outgoing bandwidth for about $20 a month. So anything that demands less than 40GB of bandwidth I'd go with RackSpace. If you go over 40GB of bandwidth, Slicehost becomes the cheaper alternative in pretty much any scenario as doubling your slice also gives you double the bandwidth.

    Even when the 256MB slices level out with 250GB of bandwidth for $65 a month, with Slicehost you could just upgrade to the third-tier slice for $70 and get not only 400GB of bandwidth but quadruple the slice specs as well.

    So for low bandwidth operations, RackSpace comes out on top. That's why I ended up going with them for my SVN server. Otherwise you're better off going with Slicehost IMO.
blog comments powered by Disqus