# stprunner Installs [gitea-runner](https://gitea.com/gitea/runner) (formerly act_runner) on a VM as a systemd service, for the Gitea at `git.adam-french.co.uk`. One `hosts/.env` per machine holds what differs between them: the runner's name, user, labels and capacity. | Host | Runner | Labels | What runs there | |---|---|---|---| | `stpvm` (VM 106) | `stpvm` | `self-hosted` (host), `ubuntu-*` (docker) | Jobs that touch the stpweb stack: deploys, maintenance | | `stpbuild` (VM 123) | `stpbuild-runner` | `build` (host) | Tests, image builds and Renovate for every repo | Both run in **host mode** as `adamf`, not in Docker: stpvm's deploy job runs `docker compose up` against the host's own stack, and build jobs use the host's Docker daemon and `sudo apt`. That is why this isn't upstream's `gitea/runner` image. ## New VM ```sh git clone http://git.adam-french.co.uk:3000/adamf/stprunner.git ~/deploy/stprunner cd ~/deploy/stprunner cp hosts/stpbuild.env hosts/.env # then edit, and commit it sudo GITEA_RUNNER_REGISTRATION_TOKEN= ./install.sh ``` Mint the token in Site Administration → Actions → Runners, or on stpgit with `docker exec gitea gitea actions generate-runner-token`. It is single-use: registration turns it into `/var/lib/gitea-runner/.runner`, which is the lasting credential. Gitea's runner list then shows the new runner. The VM needs `curl`, `git` and, for container or host jobs that use it, Docker with `RUNNER_USER` in the `docker` group. A VM without Tailscale can still be set up from the Proxmox host: `qm guest exec -- bash -c '...'`. ## Upgrading Renovate opens a PR when gitea-runner releases (pinned as `VERSION` in `install.sh`). After merging, on each VM: ```sh cd ~/deploy/stprunner && git pull && sudo ./install.sh ``` `install.sh` is idempotent: it downloads only a new `VERSION` (checking its sha256), re-applies the host file's labels and capacity, and restarts the service only if something changed. The restart waits up to 3 h for running jobs. A major release can raise the minimum Gitea version (v6 needs Gitea 1.26.2+), so upgrade stpgit first. ## Layout on a VM | Path | What | |---|---| | `/usr/local/bin/gitea-runner` | The binary | | `/var/lib/gitea-runner/config.yaml` | Minimal config written by `install.sh`; every other option keeps its default (`gitea-runner config generate` lists them) | | `/var/lib/gitea-runner/.runner` | Registration credential (0600). Back it up; losing it means re-registering | | `/etc/systemd/system/gitea-runner.service` | From `gitea-runner.service` here | Logs: `journalctl -u gitea-runner -f`. ## Changing a runner - **Labels or capacity:** edit `hosts/.env`, commit, then `git pull && sudo ./install.sh `. The config's labels override the registered ones. - **Name:** Gitea keeps the name from registration. Remove `/var/lib/gitea-runner/.runner`, re-run with a fresh token, then delete the old offline entry in Gitea's runner list. - **Adopting an existing registration** (moving a runner here from elsewhere keeps its ID): stop the old daemon, then `sudo ./install.sh --from `.