Max Rosin

For static pages like this blog I like to use Caddy as a webserver. It is (mostly) easy to configure, small, fast and easy to put into a Docker container. Recently I wanted to serve a custom 404 page and assumed it would be straight forward with Caddy. At least for me it was not. handle_errors with rewrite The documentation contains a few examples how to deal with errors, which all come down to something like this: It is also possible to limit this to 404 errors , but for the sake of simplicty we will just rewrite all possible errors to /404.html for now. This has two major downsides: It redirects the user, e.g. from https://example.com/non-existing-path to https://example.com/40…

Max Rosin

Most software projects use other projects/libraries as dependencies. And if we describe infrastructure as code we also depend on other things, e.g. specific versions of Terraform modules or Docker images. The best practice is to always specify dependencies as precise as possible to make the outcome of the build or deployment reproducible. When a codebase has many dependencies it can become a tedious task to keep track of all new releases of all dependencies and to keep the dependency definitions up to date (and tested). Wouldn't it be nice to automate this? Dependabot 🤖 Users of GitHub probably know Dependabot. It is a bot that monitors GitHub repositories and creates pull requests if it…

Max Rosin

I use a private instance of GitLab a lot and utilize the GitLab CI for most of my private projects. To speed up the CI jobs I wanted to have more GitLab runners available on demand. From our GitLab instance at work I already knew that GitLab supports autoscaling runners with docker-machine . At work we use this in combination with our OpenStack cloud, but for my personal use I was looking for a way to deploy GitLab runners at Hetzner Cloud . Searching the internet for a while led me to this (German) blog post which sounded like a good approach. So I went ahead and started to implement it in a very similar way. Long story short... I am extremly happy with the result! I can get an…

Max Rosin

Cypress is an open source testing framework that is described by its maintainers as "Fast, easy and reliable testing for anything that runs in a browser." I started to use it in the CI/CD pipeline of this blog to ensure that the website still works after I made changes. After a few days it has already proven itself to be powerful and easy to use. The only issue I had so far came up when I tried to run my tests against a development site behind basic auth . The primary issue is that the returned URL of cy.url() does not contain the basic auth credentials that are defined in the baseUrl configuration. It took me a moment to figure out why and searching the internet wasn't too helpful so…

Max Rosin

When I migrated my blog to Gatsby it took me a while to find a theme that looked good and satisfied my requirements. In the end I was not able to find an existing Gatsby theme, so I settled on the Future Imperfect theme of HTML5 UP and transformed their template into a Gatsby theme. Implementing the React part of the theme from scratch meant that I needed to integrate all logic like pagination, a RSS feed , etc. from scratch as well. One thing I was missing so far was a proper integration for the Open Graph protocol . The Open Graph protocol is used by other services (e.g. Google, Facebook, Twitter, Telegram) to determine how to display link previews when someone posts a link to…