September 22, 2011

I have been looking for a simple blogging engine to host my new Codefall blog for the last couple of months. Most of the contenders required me to install application servers (e.g. PHP, Java, etc) and an SQL server on my little Linode. That didn't seem like a great use of resources.

So I wrote my own... It was very simple - it consisted of text files with a header describing the post's title and date and the post content was markdown. That worked but I really didn't want to maintain it nor did I want to add more functionality since I am spending all my waking hours working on my startup.

Then I found Octopress. It did what my simple blogging engine did but it did it well. Lots of functionality and options and a nice default theme.

And I didn't need to run any servers on my little Linode since Octopress generates a static site! I just installed the Octopress framework on my laptop, generated the blog and deployed to my Linode using rsync. Awesome, right?

I'm running Mac OS X 10.7.1 (which is a steaming pile but that's another story) - here is what I did to get Octopress up and running:

brew install ruby     # requires 1.9.2 but OS X only has 1.8.7
gem install bundler   # the "bundle" command deals with ruby dependencies

git clone git://github.com/imathis/octopress.git octopress

cd octopress
bundle install  # install octopress dependencies
rake install    # install the default theme

vi Rakefile     # change the first 2 options - ssh_user & document_root
vi _config.yml  # change the top few options as necessary

rake generate   # create the site
rake deploy     # deploy the site

This requires your OS X box to have some applications already installed (e.g. brew, git, gcc, etc).

On the server, I just added another nginx server configuration like the following example and I was finished.

server {
listen   80; ## listen for ipv4
listen   [::]:80 default ipv6only=on; ## listen for ipv6

server_name  example.com www.example.com;
access_log  /var/log/nginx/example.access.log;

location / {
    root   /path/to/deployed/files;
}
}

The posts are added under "source/_posts" with the format described here. The useful "rake preview" command allowed me to test my changes locally at http://localhost:4000.

Exactly the solution I was looking for.