CI / CD for a static website with Hugo, GitLab and Containers

For a while I have been running my own GitLab install on one of my servers, to have a place for my private repos and some stuff I keep around. Tired of having to keep an eye on my WordPress blog continuosly, update all the time and fending off hacker attacks, some time ago I decided it was time to move to one of those new, modern, state-of-the-art static website builders. I chose Hugo for a series of reasons:

* It’s a self-contained binary, easy and quick to install on any system, be it OSX, Windows or Linux. (This no longer happens to be relevant with the new CD approach and the help of GitLab) * It is lightning fast. * It has a decent selection of themes. * It looks like it´s very, very easy to learn to use.

So once I ventured into Hugo, I started rebuiding the blog from scratch, kept all my stuff neatly in a GitLab repo and was quite happy, as I could have the hugo binary installed on all my machines (I happen to use a Mac and a Windows PC at work, and a Linux laptop and a Windows PC at home) and work on stuff anywhere by just using my remote git repository. But then I had to manually build the site locally, and upload it to my web server.

If you’re the slightest bit as I, you will correct, change, review and amend content quite often, so uploading manually wasn’t a really convenient solution.

Here is where Gitlab and its CI and CD pipelines come into play. First I was generating the site as an artifact and uploading it to my web space (Plesk at the beginning, then just a little silly web server) thanks to the excellent information on this page.

But then I started dealing serioulsy with Docker and Kubernetes at work, so what I decided to do is to start moving all my personal stuff into a containerized solution. So here is the story of my journey to Contaainers

For my own stuff I have decided to go the route with Rancher and Cattle, as the setup is much simpler than a fully-fledged Kubernetes install and fulfils all my requirements.

Volker Kerkhoff avatar
About Volker Kerkhoff
Just another DevOps Engineer. Because international IT Mystery man isn´t a job description
comments powered by Disqus