A demo on how to install and run a Forgejo runner daemon.
Find a file
2024-09-07 00:13:52 +00:00
.gitignore Initial commit 2024-09-05 13:36:23 -03:00
compose.yaml Update config and container names 2024-09-07 00:13:52 +00:00
config.yml Update config and container names 2024-09-07 00:13:52 +00:00
config.yml.bk Update config and container names 2024-09-07 00:13:52 +00:00
edit_config.sh Initial commit 2024-09-05 13:36:23 -03:00
README.md Initial commit 2024-09-05 13:36:23 -03:00

Forgejo runner guide

This guide shows how to set up a runner with Docker Compose, since the instructions in the official documentation/repo example are confusing and error-prone.

Generate config and register runner

Clone this repo and access it with your shell. Then run:

mkdir runner-data
chmod -R a+rw runner-data/
docker run --rm -ti -v $(pwd)/runner-data:/data:z code.forgejo.org/forgejo/runner:3.5.1 sh

This will create a container that already places us on the mounted volume (you can cd /data to make sure). Now we'll generate a default config.yml and a .runner, respectively.

forgejo-runner generate-config > config.yml
forgejo-runner register

The second command will start an interactive setup. Enter the fields as prompted:

  1. The first prompt will be your repo's URL.
  2. The second prompt will be a secret to authenticate your worker (in my case, I got it from /admin/actions/runners > Create new runner > Registration token).
  3. The third will be the name of your runner (just runner is fine).
  4. The fourth will be the labels to use. Simply copy the ones shown below.

In my installation, the inputs I entered looked something like this:

https://git.badmanners.xyz
A...z
runner
docker:docker://code.forgejo.org/oci/node:20-bookworm,ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04

Then, once we make sure that we have both files in the directory, we can exit the shell with Ctrl+D.

Edit config.yml fields

We need to change some default fields in config.yml. Just run ./edit_config.sh, and it will automatically take care of it for you.

Start daemon

Finally, we can start our worker:

docker compose up -d

Enjoy! 🍻