The VPS that this (and a couple of other websites) is hosted on is very cheap but hilariously limited resource-wise. Indeed, it’s remarkable what you can do with such limited resources. With the help of a friend, I even managed to tweak PHP, MySQL, and WordPress itself to get the previous iteration of this blog not to crash when refreshing the page more than once every few seconds. When renewing the HTTPS certificates, however, I needed to shut down all those services, otherwise certbot would get killed by the OOM manager. Once, I had to delete several tens of thousands of log files, and I had to get creative because bash kept running out of memory when enumerating them all.

Clearly, I wasn’t very happy with this situation, and at some point started exploring static website generators - I settled on Hugo, which is written in Go. My first attempt wasn’t very successful, as I struggled to get a nice lightbox/image gallery plugin to work. I also have little skill and even less patience with HTML/CSS, so modifying the theme to my liking quickly got frustrating. I recently decided to restart that project and to see it through - this is the result.

The theme I settled on was m10c. I then used a couple of colour palette generators to give it a more distinctive look. This was, clearly, the hardest part of this whole project. I then added hugo-easy-gallery into the mix; some frustration ensued as I grappled with the CSS to tweak some things, but I am happy satisfied with how it came out. These were integrated using git submodules and some symlinks. I used a WordPress plugin to export my old posts, but I still needed to do a lot of manual clean-up of the resulting Markdown files.

The thing I was most excited about was setting up a CD pipeline. I could’ve gone with GitHub Actions (and even GitHub pages for hosting), but I decided on a more low-tech approach. I set up GitHub to send a request whenever I do a push. I wrote a little Python server to consume that request, pull the latest changes, rebuild the website with Hugo, then publish the new version (i.e. copy the files). GitHub has some nice docs on securing your webhooks, and I had little trouble setting that up in Python.

This should have all gone pretty smoothly, right? However, my repos didn’t have a recent enough version of Hugo. I went to the GitHub page to download the standalone executable… only to discover that there is no extended version available for 32b Linux. I needed the extended one as the theme uses SASS to preprocess the stylesheets. Thanks, Web 3.0.

The next thing I tried was building it from source. Once I got an updated version of Go installed, I was ready to go. Sadly, the VPS wasn’t. I quickly discovered that, even with everything disabled, there wasn’t anywhere near enough RAM to build Hugo. Luckily, I remembered I had a 32b Ubuntu Docker image lying around from some open-source work I’d done and, after doing all of that setup a second time, I finally managed to build Hugo and get the whole pipeline working!

Here it is in action:

Typing out systemctl stop mysql never felt more satisfying.


The source code is available here: https://github.com/alexandruioanp/hugo-wh-server/

Since switching to Hugo I have had hack around with some stuff. Outcomes:

  1. A collapsible/spoiler tag plugin that supports any content and nesting: https://github.com/alexandruioanp/hugo-universal-collapsible