No Server Required - Jekyll & Amazon S3
As some of you may remember I was pretty excited when Amazon Simple Storage Service (S3) released its website feature such that I could serve this weblog completely from S3. If you have a largely static site you can rely on the enormous power of S3 to make serving your content highly scalable and storing it extremely durable. Amazon S3 is much more than just storage; the network and distributed systems infrastructure to ensure that content can be served fast and at high rates without customers impacting each other, is amazing. Just dropping your website in an S3 bucket brings all that power to you.
And it is not just purely static websites. The increasing sophistication of client-side JavaScript has redefined what dynamic means; where in the past dynamic content would be mainly server generated, today much content is served statically with JavaScript on the client side doing the dynamic modifications. A good example is the comments section on this blog; a few lines of JavaScript and these pages have a dynamic nature with comments, trackbacks and social media discussion showing up as they happen.
But while this blog happily runs out of S3, the process of creating and updating the content still required a server to run my Moveable Type installation and hold the database. I took my time to figure out what weblog CMS I was going to use to free me from having to run a server. Of course the easiest would have been to just install Wordpress on a Amazon EC2 micro instance and use a plugin to convert wordpress php to static pages and then sync that to S3. But I really want a setup that allows me to thinker with the blog where ever I am (e.g. at 30,000 feet). Ideally for me my blog content would sit in DropBox and I just run a converter to generate a version of the website whenever I want, regardless which laptop I have with me. This left me with two top choices: Cactus and Jekyll.
Cactus is a static website generator developed by Koen Bok of Made By Sofa (recently acquired by Facebook). It is simple and elegant, as you would expect from someone who has won several design awards. It is written in Python and makes use of the Django templates, which makes it very powerful. Cactus had my preference as learning more about Django was still on my todo list. Although there are some good examples that come with Cactus is still early days and there is not much of a community using it. Combine that with the generic power of Django templates and my task lists for figuring out each of the pieces for my blog was substantial. I decided to let it rest for a moment (sorry Koen) and get back to it later when I can more easily step in the shoes of others.
Jekyll also is a static website generator. It has been developed by Tom Preston-Werner of GitHub fame. It is in daily use to generate much of the GitHub pages and a whole series of weblogs. Next to that there is a very active community developing plugins and extensions which address a number of things that I want to do with the blog in the future. Jekyll in written in Ruby and uses YAML for metadata management and uses the Liquid template engine to manipulate the content. Let there be no mistake: Jekyll is not a polished high-end dashboard driven CMS, it is best described by TPW’s original charge: Blogging like a Hacker. Which suits me just fine.
I have now for the most part replicated the way that my blog was generated in MT but now using Jekyll. I am still using the same layout and css I used with MT, as I prefer to make one change at the time: design comes next. I have regenerated all pages since 2005, the pages before that can be found in the “/historical” section. There are a number of pages in the “categories” section that have not been regenerated as according to the website statistics not many of those were accessed.
My templates and blog posts are now located in DropBox and thus locally cached at each machine I use. I simple have to run Jekyll to generate a version of the site and s3cmd takes care of the rest.
In the coming days I will cleanup the templates and put them in GitHub for others to reuse. I will also submit my convertor to transform an MT installation using SQLite into input for Jekyll.
I am grateful to Matt Mullenweg for the magnificent Wordpress, it is not your fault I didn’t want to run a server, to Koen Bok for the elegant Cactus, I am sure to come back to it when I have more guts and time, and to Tom Preston-Werner for enabling me to Blog like a Hacker.
No Server Required. Amazon S3 FTW!