forgejo-runner

git clone git://git.lin.moe/forgejo-runner.git

 1# Forgejo Runner with systemd User Services
 2
 3It is possible to use systemd's user services together with 
 4[podman](https://podman.io/) to run `forgejo-runner` using a normal user 
 5account without any privileges and automatically start on boot.
 6
 7This was last tested on Fedora 39 on 2024-02-19, but should work elsewhere as 
 8well.
 9
10Place the `forgejo-runner` binary in `/usr/local/bin/forgejo-runner` and make
11sure it can be executed (`chmod +x /usr/local/bin/forgejo-runner`).
12
13Install and enable `podman` as a user service:
14
15```bash
16$ sudo dnf -y install podman
17```
18
19You *may* need to reboot your system after installing `podman` as it 
20modifies some system configuration(s) that may need to be activated. Without
21rebooting the system my runner errored out when trying to set firewall rules, a
22reboot fixed it.
23
24Enable `podman` as a user service:
25
26```
27$ systemctl --user start podman.socket
28$ systemctl --user enable podman.socket
29```
30
31Make sure processes remain after your user account logs out:
32
33```bash
34$ loginctl enable-linger
35```
36
37Create the file `/etc/systemd/user/forgejo-runner.service` with the following
38content:
39
40```
41[Unit]
42Description=Forgejo Runner
43
44[Service]
45Type=simple
46ExecStart=/usr/local/bin/forgejo-runner daemon
47Restart=on-failure
48
49[Install]
50WantedBy=default.target
51```
52
53Now activate it as a user service:
54
55```bash
56$ systemctl --user daemon-reload
57$ systemctl --user start forgejo-runner
58$ systemctl --user enable forgejo-runner
59```
60
61To see/follow the log of `forgejo-runner`:
62
63```bash
64$ journalctl -f -t forgejo-runner
65```
66
67If you reboot your system, all should come back automatically.