- ExecStart path matches the actual install location (/usr/local/sbin) - .gitignore: bare '.runner' so the secret is ignored in any dir (was only runner/.runner) - step 5: register inside ~/forgejo-runner (subshell), fix stray cd that broke the later 'cp runner/...' paths; note how to relocate a misplaced .runner Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
2.1 KiB
Desktop File
47 lines
2.1 KiB
Desktop File
# ----------------------------------------------------------------------------
|
|
# forgejo-runner.service — always-on Forgejo Actions runner on the home desktop.
|
|
#
|
|
# System service: starts at boot, no login required. Runs as your user (already
|
|
# in the `docker` group) so host-execution jobs can run `docker build`.
|
|
#
|
|
# Install:
|
|
# sudo install -m 0755 forgejo-runner /usr/local/sbin/forgejo-runner # the binary
|
|
# mkdir -p ~/forgejo-runner && cp config.yml ~/forgejo-runner/
|
|
# cd ~/forgejo-runner
|
|
# forgejo-runner register --no-interactive \
|
|
# --instance https://git.joshbairstow.com \
|
|
# --token <REGISTRATION_TOKEN> --name desktop --labels desktop:host
|
|
# # ^ writes ./.runner (credentials) into ~/forgejo-runner
|
|
# sudo cp forgejo-runner.service /etc/systemd/system/
|
|
# # (edit User=/paths below if your username differs)
|
|
# sudo systemctl daemon-reload
|
|
# sudo systemctl enable --now forgejo-runner
|
|
# systemctl status forgejo-runner # expect: active (running)
|
|
# journalctl -u forgejo-runner -f # watch it claim jobs
|
|
#
|
|
# Why WorkingDirectory is under $HOME: this machine's Docker is snap-based, and
|
|
# snap confinement blocks the daemon from reading build contexts outside the
|
|
# user's home — so the checkout/build must happen there, not in /opt.
|
|
# ----------------------------------------------------------------------------
|
|
|
|
[Unit]
|
|
Description=Forgejo Actions runner (jb CI)
|
|
Documentation=https://forgejo.org/docs/latest/admin/actions/runner-installation/
|
|
After=network-online.target snap.docker.dockerd.service docker.service
|
|
Wants=network-online.target
|
|
# Disable the start-rate limiter so it keeps retrying until Docker is ready at boot.
|
|
StartLimitIntervalSec=0
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=joshbairstow
|
|
SupplementaryGroups=docker
|
|
WorkingDirectory=/home/joshbairstow/forgejo-runner
|
|
Environment=HOME=/home/joshbairstow
|
|
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
|
|
ExecStart=/usr/local/sbin/forgejo-runner daemon --config /home/joshbairstow/forgejo-runner/config.yml
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|