François Kooman 0e1240a92f
All checks were successful
checks / build and test (pull_request) Successful in 1m16s
checks / runner exec tests (pull_request) Successful in 48s
/ example-docker-compose (pull_request) Successful in 2m52s
/ cascade (pull_request) Has been skipped
add instructions to run under systemd user services
2024-02-19 09:09:57 +01:00

1.6 KiB

Forgejo Runner with systemd User Services

It is possible to use systemd's user services together with podman to run forgejo-runner using a normal user account without any privileges and automatically start on boot.

This was last tested on Fedora 39 on 2024-02-19, but should work elsewhere as well.

Place the forgejo-runner binary in /usr/local/bin/forgejo-runner and make sure it can be executed (chmod +x /usr/local/bin/forgejo-runner).

Install and enable podman as a user service:

$ sudo dnf -y install podman

You may need to reboot your system after installing podman as it modifies some system configuration(s) that may need to be activated. Without rebooting the system my runner errored out when trying to set firewall rules, a reboot fixed it.

Enable podman as a user service:

$ systemctl --user start podman.socket
$ systemctl --user enable podman.socket

Make sure processes remain after your user account logs out:

$ loginctl enable-linger

Create the file /etc/systemd/user/forgejo-runner.service with the following content:

Description=Forgejo Runner

ExecStart=/usr/local/bin/forgejo-runner daemon


Now activate it as a user service:

$ systemctl --user daemon-reload
$ systemctl --user start forgejo-runner
$ systemctl --user enable forgejo-runner

To see/follow the log of forgejo-runner:

$ journalctl -f -t forgejo-runner

If you reboot your system, all should come back automatically.