skip to main content

Moving the blog from Gitlab to Sourcehut

This week I have moved my blog from Gitlab to SourceHut among a few other repositories.

Gitlab is a wonderful git host. I am always relieved to know that Gitlab is the choice for source repositories and CI in my work projects. This move was not motivated by the upcoming changes to Gitlab free plan. It has been on my mind ever since I discovered SourceHut.

SourceHut is an open source hacker-style collaboration platform. It is primarily a git repository host that includes commonly associated services such as continuous integration, mailing lists, issue tracking, IRC, wikis and some more. It was created by a prominent open source developer Drew Devault.

All these services are hosted on their own subdomains, for example git on https://git.sr.ht, CI on https://builds.sr.ht. In a way, these are all microservices tied together by an identity service that links everything to your account.

All the microservices included have the following personality:

  • Fully open source
  • Self-hostable
  • Zero JavaScript †
  • Zero advertising and tracking
  • Super fast and light

† There is a tiny JS snippet that simply refreshes the build status every 5 seconds.

I was left with two sites on a single domain the last time I did some reorganization of my online presence stuff.

  1. The portfolio at https://anmsh.net/ stored on SourceHut

  2. The blog at https://b.anmsh.net/ stored on Gitlab

I always wanted a single website that could both be a portfolio, a blog and a personal wiki. At the time, the blog was already living on gitlab with the CI setup and the auto SSL setup. I created a separate static portfolio site on SourceHut to learn about its capabilities. It was only logical to move to SourceHut immediately. To do this, a few key requirements came up.

Migration requirements

Posts live at anmsh.net/post/

This means that

  • the subdomain b.anmsh.net is no longer needed. ✔
  • a single SSL certificate is sufficient and a simpler certbot command. † ✔
  • the merged site must be a Lektor site because it couldn't work with a HTML page. In this case, this was the static index.html that existed in the portfolio site.

† Used a wildcard domain .anmsh.net, but Gitlab auto SSL didn't work with this and I needed to do both auto SSL for the blog and the wildcard renewal for the portfolio.

New index page

This means that

  • the index page from blog will still be a combination of layout+header+footer+search
  • the content and structure of the new index page will be similar to the one from portfolio site

Simplest git workflow

A git push to the main branch for both code and content changes. I did use a feature branch workflow until now, but I am done with it. This is way less maintenance overhead. ✔

Replace Gitlab CI with Sourcehut Builds

This had a few steps. Technically, this move was not just about the blog's source code, but also where it gets deployed. I wrote about this in the post Deploy to Linux VPS with SourceHut Builds.

  • Use the same docker image python:3.10-slim-bullseye or find an equivalent. ❌

    This did not work at the moment, since SourceHut did not have custom slimmed down images. I went with the Debian Testing image for the time. This did increase the build time by 13 seconds from when I was using the python slim image over at Gitlab. (36s to 49s)

  • Lektor build part to be introduced. This was relatively easier. So I will count it as win. ✔

  • Upload task remains the same. ✔

Missing things

  • Milestones and contribution history

    I do not need such niceties anymore, but these two were worth a mention.

  • PR/MR workflow

    I am committed to learn the SourceHut's git send email workflow. I use the PR/MR workflow heavily at work anyway. It may annoy me a bit initially. However, my love for emails as an async communications tool and a thinking tool made me ready.

  • Custom Python slim image

    This is the only real missing thing and hopefully a temporary challenge.