How this blog is deployed

Introduction

My first website I published was a very simple HTML page — it just contained my name and address and thus served as imprint, mainly for the mail engineers over at Deutsche Telekom. It was built into an OCI container and was then manually deployed using my Portainer instance. The main server used by this Portainer instance is a cloud vm hosted by Hetzner.

When I came up with the idea of this blog it was clear to me that a manual deployment would not be feasible over the longer run. I wanted a system where I could just push new content into a remote git registry which then would take care of deploying the new version.

Luckily, Gitea — the git server I use — published the first versions containing Gitea Actions around this time. Gitea Actions is a system similar to Github Actions — to which it is relatively compatible — or Gitlab CI/CD. While it is compatible to Github Actions and can use actions defined for Github just as well, it allows to easily specify own runners, which can be hosted on own hardware. This principle allows me to keep everything — from managing the content, to building it, to finally deploying and hosting the website — on my own infrastructure.

Zola — Generating the website

As the website is not updated very often and does not need many features or dynamic content, using a static site generator seemed like the right choice. I did not use a static site generator before, so I researched the possibilities which supported blogs and provided themes. In the end I came to the conclusion to use Zola with the tabi~ theme. Zola is written in Rust and offers fast compilation while being easy to use. Content can be created using Markdown which will be converted to HTML-files during the build process.

Gitea Action — Building the website

Gitea Actions can be configured using a YAML-file in the directory /.gitea/actions, this reminds to the location of Github Actions — which can also be used. The workflow consists of several steps which are executed after another. First, the docker environment is prepared. This is then used to build an image and pushing it to my container registry. These steps use actions provided by Gitea — which are mostly mirrors of Github's actions.

Gitea Action — Deploying the built image

For deploying an image to a Portainer stack managed by a git repository, there was no action available. So using this action as a basis, I added the possibility to redeploy a Portainer stack backed by a git repository. This action is used to trigger a redeployment of the stack using the freshly new built image from the registry.

Improvements

Currently, this website is backed by a Hetzner VM running one Docker Container serving the website (and other unrelated stuff). Although I never had any problems with the VM, the container sometimes gets problems and does not automatically restart. In the future I would like to experiment with more advanced deployment technologies like Docker Swarm or even Kubernetes.

Also, this site currently has no statistics whatsoever. As much as I like that, in the future, a count of users of the like can be interesting. This will however be as unobtrusive as possible and announced here.

If you have any questions regarding the deployment, feel free to reach out. I'm happy to add more information on this page as needed. If you encounter problems using my Github Action, you can also create an issue on the repo.