Living The Static Life

If you can read this, then this site is now being statically rendered and served from Azure storage (all 8000-odd posts and reference pages in it, spanning around 16 years).

This has been in the works , but I had to set things up to require as little maintenance as possible, so over the past couple of weeks I gradually eased all the bits into place and threw the master switch this morning.

Given the amount of legacy content and my custom media and cache handling, moving this to a “mainstream” static site generator like hugo was pretty much impossible without months of re-formatting, so I did the sensible short-term thing:

  • Wrote a quick and dirty 300-line static site generator atop the core engine.
  • Got that to write directly to Azure storage using my own library (which is way faster than the standard Azure SDK).
  • Got piku to only fire up workers on demand (significantly decreasing the RAM and CPU requirements to host the back-end). Update: Just got it to run cron jobs as well, which makes some things even simpler.
  • Set up Cloudflare to do the necessary rewrites where possible (and normalized my URL namespace to lowercase while I was at it).

So the site is now updated via a GitHub web hook (which conveniently provides enough info for re-rendering only what needs to be updated) that kicks off rendering on a tiny VM where I’m also putting some other services.

Eventually, the generator itself will be pared down into a smaller, tighter codebase and go into a GitHub Action or an Azure Function1 like my sample data pipeline, although I’m still of a mind to do a full rewrite in (which won’t solve the need to cope with legacy formatting, but will likely be more fun to code).

And no, I didn’t see a need for using Kubernetes here.

Caveats

There are always compromises, obviously, and I wanted to get this done sooner than later, so these are the salient points for now:

  • Archives are temporarily out of commission as I’ve been meaning to re-do them properly for a while.
  • Search (a key feature of the original engine, which leveraged SQLite full-text search and was great fun to write) is now handed over to DuckDuckGo.
  • Dynamic redirects to “similar” pages (which I relied on to quickly get where I wanted by tweaking the address bar) are now client-side, which is kludgy but works.
  • I’ve yet to do proper client-side instrumentation (I’ve got all the usual analytics stuff on, but I’d like to re-visit things like page load times, errors loading assets, etc. to understand if things are broken somewhere I don’t notice offhand).
  • I’ll need to tweak caching and HTTP headers a bit. Azure Storage has some nice features for setting blob metadata, content-types, caching attributes and whatnot, and I’m just using the bare minimum for now.

Most importantly, there should be no broken URLs – that is, other than a few legacy hang-ups that I’ve decided to clean up, like the ancient RecentPages RSS feed that harkened back to PHPWiki days.


  1. Most likely the former than the latter, as there is no way to clone git repositories from a function and I’m not exactly enamored with the current Azure Functions runtime for various reasons. ↩︎

This page is referenced in: