From AppEngine to Cloudant and Linode
The last rewrite of the code which runs this site was in 2009, when I changed from a static site generator I’d written in ruby to an AppEngine site I wrote when I was first learning python. In the main I was very happy with AppEngine: I’d not paid them a cent but they’d happily hosted my site for five years.
Lately, however, I’d begun to want a better understanding of the technologies the site runs on. AppEngine’s abstractions were becoming to much. I’ve wanted a server of my own for a while; I chose Linode (referral URL) because my friends using it haven’t had many bad words to say about it. I chose Cloudant because I work there and wanted to have an app I – sort of! – depend on running there.
While Linode and Cloudant are more abstract than running everything on a single physical server, they are at a lower-level. For Linode, I can make decent guesses as to the stack; it feels more graspable. Working at Cloudant, I’ve a decent understanding of the stack Cloudant use, and have contributed code across the service.
Overall the migration was very smooth, and proceeded in two stages:
- Continue running on AppEngine, but migrate the data layer to use Cloudant.
- Migrate the web app to run on Ubuntu on Linode.
Step 1 was the more complicated one, and I’ll probably write up something of the model and views I use for the site. For now, it suffices to say that, aside from when editing posts, every page on the site is driven by one or more Cloudant views rather than pulling the documents directly. While my data is miniscule – around two or three megabytes – the Couch model is a good fit, so I’m happy with that choice.
Step 2 was straightforward as the site didn’t use much AppEngine-specific functionality. It’s a cherrypy web app, using mako templates along with a few other libraries like markdown. The main change was choosing how to authenticate myself to the backend, as this was the main place I’d tied myself to Google’s infrastructure. For now, I’m just using HTTP basic-auth, with the site’s config file containing a username and hashed&salted password, and have removed multi-author support.
AppEngine also has an automated deployment tool, so there was also a bit of work in moving the source code to a private GitHub repository and setting up keys so the Linode server can check the code out. Once I’ve given the code a once over, I’ll probably make the repository public so the server doesn’t need any credentials for my GH account.
The actual sysadmin work on the Linode server was minimal, basic security steps followed by installing nginx and supervisord from the package manager. This stuff really isn’t hard if you’re just running a website or two, though I confess to relying on the assumption that the Ubuntu packages provide a secure installation.