Raspberry Pi as Forgejo Runner

In my instructions on how to setup Forgejo with a runner, I used a Hetzner server for the runner. This costs roughly 5 euros per month, so 60 euro annually.

A full Hetzner server might be a bit overkill for a simple runner. Especially if you are just running Shell scripts or static site generation. The Hetzner server supports things like high bandwidth, low latency, unique IPv4 address, high uptime guarantees. Most of these are not necessary for your own runner.

Therefore, in many cases it's probably a good idea to run the Runner on your own hardware. What I have tested and works for me is to use a Raspberry Pi 4 with 1 GB RAM and a 32 GB Class A MicroSD. At the time of writing, the price for these was €44 for the Pi and €10 for the MicroSD card.

To setup the Forgejo Runner, flash the Raspberry Pi OS Lite image on the MicroSD via the Raspberry Pi Imager. Next, boot this image, connect to it via SSH (like you would with a Hetzner server), and configure the runner as described in the other post. Then it should work. It did here.

To make the system a bit more robust, I admittedly changed the MicroSD for a NVMe SSD with an NVMe to USB adapter. The price for this was €40. This should be more robust since NVMe drives have more logic on board to proactively detect and mitigate failing blocks. Maybe the MicroSD would have failed after a year, who knows. With the NVMe, the system should be able to run without hardware failures for a few years at least.

A cheaper option might be to set the system to read-only. This can be done on a Raspberry by enabling the OverlayFS. Alternatively, in /etc/fstab, add commit=300 to the mounts options for the SD card. Based on a comment, "Linux will normally write out changes to the filesystem every 5 seconds. commit=300 caches writes for 5 minutes (when possible) and does one write. Very easy change, greatly increases SD card life. ...and the whole operating system works like normal."