Hosting Octopress on a Unix Box

I finished setting up Octopress on GitHub Pages today and wanted to publish it at my personal url. Initially, I planned to CNAME my domain to GitHub, but apparently that feature is only available for paid accounts.

If you already have a paid personal GitHub account for other reasons, by all means use that. I’ve been hosting a few other sites an an Ubuntu based Apache server for the past few years, so I decided to use that instead. Here’s how I did it.

First, I set up my Ubuntu box as a git remote. There are a few different ways to do this, but I opted for the method employed by GitHub (single git user for all repositories) because I wanted to be able to host some other repositories as well. Check out this guide for some pointers on how to do this: http://www.corvidworks.com/articles/self-hosted-remote-git-repositories

Second, I updated my local configuration to push to this new remote. Since everything was already set up to deploy to my personal GitHub page, this was simply a matter of editing _deploy/.git/config to point to my new repository URL. I also changed the name of the new remote and updated the deploy rake task to print different info, but this is an optional step.

Finally, I cloned the repository to my Apache document root and made a quick post-receive git hook.

Now I can run rake deploy and the site gets updated on my basement server.

BOOM!

First Post With Octopress

Yesterday, I set up this blog using the excellent Octopress framework. If you’re not familiar with it, Octopress is an extremely lightweight blogging solution that runs on Jekyll. No databases, cluttered web UIs, or Wordpress PHP. And because it uses Jekyll, hosting your blog on GitHub Pages is a snap.

Write a new post in Markdown:

1
2
rake new_post['First Post with Octopress']
Creating new post: source/_posts/2012-06-02-first-post-with-octopress.markdown

Publish to GitHub:

1
2
rake generate
rake deploy

With a framework like this, I might actually start blogging. We’ll see.