Taffel.se -> EC2

October 18th, 2009

Taffel.se is currently hosted at  a Swedish shared hosting provider (Oderland). We’ve been very pleased with the price and quality of their service, but with a shared host there are naturally limits to what is possible to build. Since Taffel.se is (in practice, although not in principle) a non-commercial site, I haven’t had time to spend much time developing it. But we’ve got some new ideas that we’d like to try, including some improvements that couldn’t be implemented on the shared server. Renting a server is very expensive for a project that doesn’t make money, an order of magnitude more than what we’re paying now, especially if I want someone to take care of making backups. So I decided to look into Amazon’s EC2 offering. After a few days playing with it, I have to say wow! EC2 seems to offer all of the advantages of having your own server and none of the disadvantages. It’s very cheap, and making backups of your data is trivial. And you can have as many test servers as you want. As long as you don’t keep them running when you’re not using them it doesn’t cost much.

For those of you that don’t know, EC2 (elastic computing cloud) allows users with an Amazon account to create virtual servers on demand, based either in Europe or in the US. Each server is based on a machine image (AMI) which you can create yourself or you can use one of the thousands of freely available images created by Amazon or other users. An image is basically a linux/unix installation (Windows is available at a higher cost) which can be customized for a specific purpose. You can create as many instances from an image as you like. The storage on a virtual server is ephemeral, meaning that it only exists as long as the instance is running (storage survives rebooting as long as you don’t terminate an instance). For persistent storage you can create an elastic block store (EBS) which is like a virtual disk that you can attach to an instance (you can even create several and combine them into a RAID). The data on an EBS doesn’t go away when you terminate the instance. Even better, you can take a snapshot of an EBS, a process that takes seconds and stores a copy of everything on the disk in Amazon’s S3 storage service. You can create copies of an EBS based on a snapshot and attach them to new instances. And it works incredibly quickly.

I chose to use 2 EBS volumes, one for databases and other application data, and one for source code. That way I can easily make changes on a test server instance and try it out with the most recent data from the production server. Brilliant! Instead of creating my own AMI I’m using an official Ubuntu AMI with a minimal install. I’ve written a shell script that starts an instance, installs all of the software I need using apt-get (that way I never need to worry about updating software – I can just start a new instance now and then), creates EBS volumes from snapshots, attaches them and mounts the volumes in all the right places. So in about 10 minutes I can have a new server with everything working. Well, almost everything. I have everything from Taffel.se running on a test server except mail. I’m no expert on configuring mail servers, so this may take a little while, but this article seems like a good start. As soon as I have everything working Taffel.se is moving to EC2.

I’m very impressed with Ubuntu as well. Setting up a Linux server is incredibly easy these days (although of course I didn’t have to do it from scratch). An excellent resource for using Ubuntu on EC2 is Alestic.com. Eric Hammond from Alestic wrote this very useful article on EBS and MySQL as well as this script for taking consistent snapshots of EBS volumes with databases on them. Lots of other useful stuff as well.

Create iCal to-do from a mail message using AppleScript

January 10th, 2009

I use Things for task management on my mac and iPhone (okay, I’m not as consistent as I’d like, but I’m trying). I simply find the interface cleaner, simpler and aesthetically far superior to the alternatives such as OmniFocus and iGTD. There are disadvantages, though. The pace of development is very slow. I’ve been using the program in beta for a year and version 1.0 was just released. Also, OmniFocus and iGTD (for example) have much better integration with other programs, like Mail. One feature I’ve been waiting for is the ability to create tasks from mail messages. I wanted to be able to select a mail message and automatically create a new task with the subject of the message as the task title and the contents as a note. Unfortunately this feature is still missing in the 1.0 release, so I took matters into my own hands. Read the rest of this entry »

Combining content from multiple blogs

November 30th, 2008

I have written earlier about the multiblog structure of Taffel.se. We actually use WP blogs in two ways: as blogs (such as Kort om gott, Matälskaren and this blog) of course, but also as content databases for recipes and kitchen tips, among other things. The latter blogs are separate blogs on the back end, but for the reader they appear to be integrated with the main website. In this and some future posts, I will explain how this integration is achieved with remarkable ease.
Read the rest of this entry »

Multiblog single login in WP 2.6

November 18th, 2008

As described in the last post, Taffel.se is built from a number of WP blogs that share common user tables. After the next overhaul of the site is completed, users will be able to create user accounts that will work for commenting and the forum (which will be run on bbPress). Not only should these accounts be shared among the blogs that make up the site, but the user should not have to log in again to move from one blog to another. Here is how you can make this work.
Read the rest of this entry »

Multiple blogs update

November 18th, 2008

In my last post I described how I use a single WP installation for multiple blogs.

In this support forum topic MarsChelios suggests a more elegant looking capabilities.php fix:

  $this->cap_key = CUSTOM_CAPABILITIES_PREFIX . 'capabilities';
else {
  $this->cap_key = $wpdb->prefix . 'capabilities';

which lets you configure which capabilities table you want to use in your wp-config.php. Of course this still means hacking the WP source, so really making it configurable is just a matter of aesthetics and not maintainability.

The same forum thread points out that this is ‘broken’ on purpose, as these trac tickets make clear. You’re supposed to be able to have different capabilities for each blog, even if the user tables are shared. This actually makes sense. I need to look into this more.

Multiple blogs with one WordPress install

November 17th, 2008

Taffel.se is built from multiple blogs. The magazine itself is a blog (technically speaking), as are of course the actual blogs associated with it, like Kort om gott and Matälskaren. Less obviously, the recipe database and (coming soon) kitchen tip database are also WordPress blogs (more about how those two are integrated with Taffel.se in a later post). Running lots of blogs with separate WordPress installations would be a huge administrative headache, but fortunately it isn’t necessary.

Read the rest of this entry »

In media res

November 17th, 2008

I design and code the Swedish food magazine/ blog cooperative Taffel.se. On WordPress, of course. I’m currently working on a major redesign and code rewrite.

I spend a lot of my time getting WordPress to do things it wasn’t really designed for. The purpose of this blog is to document how it all works, mainly for myself. But hopefully others will find some of this useful.