Blog.reboot()

Posted on Sat 18 June 2016

This blog is now a static website powered by the Pelican generator. It's the 3rd major change since I started blogging in 2002.

It began with Movable Type, a Perl blogging tool. There wasn't much choice at that time, and it did the job even if I did not like Perl (and still do not). In 2009 I switched to Drupal 6, which allowed me to have a nicer visual layout and have more control on the navigation, starting with clean URLs.

Now for a blog I don't need a full blown CMS for dynamic web pages, with the operational burden what comes with it. Also, the content writing UI in Drupal isn't that great (or wasn't, since I stayed with Drupal 6), and you ultimately end up writing HTML, even if hidden behind a fancy WYSIWYG editor. So much for semantic markup and separation of content and presentation.

Over time, the combination of Twitter's 140 characters instant gratification and a clunky writing UI led this blog to be really neglected. Now I have things to share that don't fit in a tweet!

Going static

So it was time for a change, and I was urged in that by my two sons Corentin and Théophile who started a "one blog post a month" challenge. Instead of just writing a blog post, I decided to reboot this blog so that the urge or writing would not be hindered by an unfriendly tool.

The 3 of us are now running our blogs with the Pelican static blog generator. I also did some quite extensive tests with Nikola, but in the end Pelican won because of its larger theme library that allowed me to experiment faster. Nikola's speed and live reloading while editing content are definitely better than Pelican's though, and now that I have settled on a theme I may come back to it.

Why not using the popular Jekyll or Hugo? The main reason is that I want to store my content in a format that is stable, well defined and with enough builtin features for documents that go beyond the simple set of headings, text and code snippets. I want to own my content, and I want it to last.

This rules out Markdown, since every tool comes with its own dialect and extensions, even if some are more popular than others, and even with the CommonMark initiative. Same for Textile who also seems to be falling into oblivion.

The remaining contenders were reStructuredText and AsciiDoc, who both have a formal specification. Their reference implementation is written in Python, so choosing a Python-based generator seemed a natural choice. Sure, other generators can use RestructuredText and AsciiDoc by forking external processes, but having the parser within the generators allows for tighter integration and greater generation speed. AsciiDoc also has the great AsciiDoctor Ruby implementation, but I'm no rubyist.

ReStructuredText has fewer syntactic artifacts than AsciiDoc, meaning less cognitive load for the same document complexity. So I'll use reStructuredText as the main writing format, knowing that the great Pandoc can do wonders converting from one syntax to another.

Setting up the new blog

The full configuration is published on GitHub. Actual content and deployment configurations are in a separate private repository.

The theme is based on StartBootstrap's Clean Blog and its Pelican implementation which I modified slightly. I still have to clean up the CSS and trim down Bootstrap to what's actually needed.

The banner images are randomly generated from a set of banner pictures (taken by me), unless I explicitly specify one in the post's metadata. I had this in the Drupal-based version, and love it since it gives a nice visual touch to pages without requiring scouting for an appropriate picture when none comes to mind quickly (choosing images is hard!)

The old content is still in HTML, and was extracted from Drupal with a tiny scraping script. It was actually easier than getting it out of the database, since over time I used various Drupal output formats. I'll progressively go through all past 369 (!) articles to convert them (again with Pandoc), clean up broken links and harmonize the layout.

The comments are now powered by Isso, a self-hosted Disqus clone, and I have imported the old comments from Drupal with a custom Python script. Again, I want to own my content, and comments are an integral part of it.

Publishing is not yet automated, and won't be until I a become a really proficient writer. Running a makefile once in while is good enough for now!

Hosting

And since this is a reboot, I also completely overhauled the infrastructure. This blog has been running for ages on a bare metal server, which I carefully nurtured and updated. Devops and immutable infrastructure are all the rage these days, so I used at home the same techniques I use at work: this blog is now running (warning: buzzwords ahead!) as a set of Docker containers managed with a simple docker compose file. The containers are running the Træfik reverse proxy in front of the Caddy file server and the Isso comment server.

If you don't know Træfik and Caddy, you should definitely have a look: they took a fresh start to web servers, taking into account the latest evolutions of the web: you get instant HTTP/2 and painless free SSL with Let's encrypt.

The server is a 3€/mo VPS which I can setup with a single command. Now I hear you say "if this is a static blog, why not using Github Pages"? Well, call me a masochist, but I actually enjoy tweaking my server. I've been doing it for more than a decade, and it's nice to have your own playground where you can experiment and break things!

Now enough with this meta-post. I've started collecting ideas and drafts for real content in this new shiny home!



Efficient storage of non-periodic time series with MongoDB

Afternoon hack: a USB foot keyboard