Hello, yet again

The latest iteration of whyitsabadidea.com; or why Hakyll, S3, et al. are awesome.

I have a rather unproductive tendency to rewrite my website every year or two. In this latest round of ground-up-rewrites, I killed the server and moved directly to a static site.

The current stack:

  • Hakyll, a Haskell library for generating static sites, is used for just that - posts are stored in Hakyll’s markdown + meta-data fields format in a Git repo, and Hakyll takes care of routing and generating markup. I’m rather pleased with Hakyll, as installation is trivial (cabal install -fhighlighting pandoc; cabal install hakyll), and configuring it fits well with my Haskell masochism (Here’s some libraries. I hope you like arrows and an EDSL!).

  • S3 for hosting - cheap and very scalable. Indeed, too scalable perhaps - I’m looking at ways to put a bandwidth cap on it.

  • I’m using Git for version control of both the site’s source and generated markup - the later is necessary only because I want to push modified files to S3, but Hakyll messes with all files’ modification-timestamps. File content must therefore be compared to get a site diff, so Git is the logical choice. This has a number of nice consequences, such as ease of reverting to old versions if the site’s toolchain is broken and (if I were clever enough to use a root-branch for the output, instead of a different repo) hosting on Github pages.

  • s3sync actually takes care of parsing Git for changes, and uploading them to S3 with proper headers.

The main drawback of this approach is that it makes posting new content almost totally dependent on access to my computer: at the very least, it requires access to two git repositories, two custom Haskell scripts, sass, a good text editor, and my AWS credentials. Thus, blogging while traveling without a laptop is basically impossible - although I hardly ever do this, so it’s slightly irrelevant. Firing up an EC2 instance with the requisite tools (and possibly a web interface) seems like a trivial way to solve the problem.