Nothing like killing a bunny with a rocket launcher, or in otherwords, dramatically over-engineering something. We used to have it as a saying on old software development team I worked for. Well. This is it. You're looking at it. A load balanced, replicated blog, using a CDN, for something that would realistically be handled with just static HTML on a single server. It originated from a fascination with looking at the MongoDB 'hype', and ended up refitting the mechanics car with a V8.
The $100/mo challenge
So of course, the first thing, is always a budget. $100/mo seems like a nice round number. What can I build for that ? Requirements are it must be redundant, if I mess one server up, the whole lot can't turn to custard. I've gotta be able to serve images to my friends everywhere, fast. I've got to have flexibilty to post whatever the hell I like. Use the best tool for the best job. Pages must be generated fast (no one likes slowness). Anything below 200ms would be good. It's got to look half decent, and degrade gracefully on people, use 3rd party services where it makes sense, and finally allow me to play with stuff when I want. Oh, and good uptime too. I like having my blog up when people visit it, otherwise what's the point ? (*cough* Posterous *cough*).
Starting small
But first things first. I had to get something up quick smart, so people could see my awesome trip to Peru. (when not doing deliciously nerdy stuff, I like to ride Mountain Bikes fast..). Time was of the essence, I'd just gotten back, everyone wanted to see pics. So no time to waste and I didn't want to ruin the photo experience by just dumping on Facebook, or Flickr. I'd half built the blog on a plane, on a previous trip. Time to finish it off. 1 week later. Done. Dusted and up.
Scratching the itch
It was running on one Linode, so staging and production became painful. Where there's an itch there's a credit card. 10 mins later, I had a new 'production' environment. I'm using 'production' in quotes as really, this is a blog which gets no traffic. And here I am with two Linode 768mb machines, and a Nodebalancer. Bam bam. Done. An hour of configuration later, and we have two live, load balanced servers. A couple of hours more and we have learnt about MongoDB Replica sets, copied over the database from (the shortly to be) staging box, dumped it into the a single MondoDB instance, fired up two more, switched on replication and wahey! Over engineering was readily apparent - but data was distributed.
So now I've got servers, database, time to get the app running. Much to my suprise it only took one line of a different database connection string and bam! we now have my app talking to the replica set. (Top marks 10Gen on MongoDB by the way, error messaging actually makes sense.. and installation/configuration is a snap). Now she's ticking over smoothly. Capistrano Multi-Stage is making me pine less for Websitrano at home - at work it is our religion - however deployment is smooth, and the thing is pretty damn redundant.
Next up ... GridFS :)
