For to be to make you smarter. For to be to get you dead.

blosxom and git 2012-06-04

When I moved all of my servers away from apache2, I started using blosxom in static mode. There's no dynamic content on this blog anyway, so there wasn't much sense in trying to get the CGI to cooperate with nginx. As such, I made a Makefile to build and deploy the site for me, which was pretty rad.

The site is also maintained in a git repository, though, and so I had the idea that pushing to the git repo should just automatically update the website. Here, I will share how I achieved this awesome magic.

First of all, I had to make a few changes to blosxom to get it to play nice with a git repository.

Here is my modified blosxom (based on 2.0):

Next is the Makefile I use to generate the static pages for blosxom. It also renders a minified stylesheet from my lesscss source file.

Now with these in hand, I am set up with my original plan. After writing my posts I could deploy as such

$ make
$ rsync -avz --delete  htdocs

But since I would need to push the changes back to git anyway, there's no reason to take that step. In order to do this, there are only a few easy steps. First, create a bare repo on the machine that hosts your blog and add a post-receive hook to it:

$ mkdir
$ cd
$ git init --bare
$ touch hooks/post-receive
$ chmod +x hooks/post-receive

The post receive hook I use is extraordinarily simple, since I already had the Makefile to do most of the work:

Now, back on your local machine, just add this new repo as a remote and you will be able to push to it to update your blog:

$ git remote add deploy
$ git push deploy master

Happy blogging.