How Interblah Works
; updated James Adam
Murray asked for an overview of how this site is put together, and here I am obliging.
From the server perspective, this site runs on a VPS, under Apache and Passenger. interblah.net is an Apache virtual server; here’s the config:
DocumentRoot /var/www/apps/interblah.net/public <Directory "/var/www/apps/interblah.net/public"> allow from all Options +Indexes </Directory> ServerName interblah.net ServerAlias www.interblah.net Alias /assets "/var/www/apps/interblah.net/assets" RedirectMatch 301 ^/2006/\d+/\d+/(.+) "/$1" RedirectMatch 301 ^/2007/\d+/\d+/(.+) "/$1" RedirectMatch 301 ^/2008/\d+/\d+/(.+) "/$1"
The Alias directive is something I’ll probably lose, now that public
is a proper directory in a Vanilla application, but exists to support URLs from older incarnations of the site; likewise for the Redirects, which handle old Mephisto URLs.
Passenger is configured to use Ruby Enterprise Edition, since I have a bunch of other sites on the VPS and want to conserve memory.
The contents of /var/www/apps/interblah.net
are available on github; this is the site directory that Passenger runs.
Here you can see the config.ru
that boots the application; this require
s vanilla, which is normally the latest vanilla gem. Previous incarnations of my site ran directly off the vanilla source, which was useful for tweaking the system, but made it much more complex to deploy. By making the Vanilla code external, the site contents itself can be packaged into source control and deployed directly.
The Vanilla gem depends on a few other gems, all of which will be installed automatically when installing the vanilla gem:
- soup
- Redcloth, Bluecloth and now Redcarpet
- Treetop (I’m dynamically loading the snip reference parser, although technically that’s not required)
- ratom (used to generate the site feed in the
kind
dynasnip, and required libxml itself)
The most important of these is the soup gem. When the appliation starts, the application instantiates a ‘soup’, based on a subdirectory of the site code (here is interblah’s). That directory is defined by default in the site’s config, passed in the config.ru
The config.ru
pushs a local lib
path at the start of the $LOAD_PATH
, which is intended for dumping site-specific code, although I haven’t used this yet. The public
directory is also a part of the site, for custom images and CSS and whatnot. Finally, the tmp
directory needs to be there for Passenger to work. You’ll see in the interblah source that the lib
and tmp
directories are missing; this is just because git won’t store empty directories.
I have a few other gems installed for various dynasnips that I’ve written specifically for interblah.net
- syntax (used by the code dynasnips)
- defensio (was used by the comments dynasnips, until I instigated by policy On Commenting)
Hmm - this is a bit rambly, so here is…
Summary
- Apache with Passenger & REE
- Vanilla installed as a gem via Bundler
- dependencies include Soup
- Site exists as a git repository
- I now edit locally, using
rackup
to preview the site on my machine - I typically edit using a text editor, although you can use the web interface locally
- I commit and push up to github
- I now edit locally, using
- To deploy, I just check out this repository on the server using a fairly standard Capistrano recipe.