actions/setup-node's Node 26 fails on minimal Ubuntu 24.04 with 'libatomic.so.1: cannot open shared object file'. RUNNER_APT_PACKAGES in the host file lists packages install.sh installs when missing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
80 lines
3.6 KiB
Markdown
80 lines
3.6 KiB
Markdown
# 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/<host>.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/<host>.env # then edit, and commit it
|
|
sudo GITEA_RUNNER_REGISTRATION_TOKEN=<token> ./install.sh <host>
|
|
```
|
|
|
|
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. Host-mode jobs that use
|
|
JavaScript actions (`actions/checkout`, `actions/setup-node`, …) also need
|
|
`node` on the host, or they fail with `Cannot find: node in PATH`: set
|
|
`RUNNER_NODE_VERSION` in the host file and `install.sh` puts that release at
|
|
`/usr/local/bin/node` (only `node`; jobs get their own Node from
|
|
`actions/setup-node`). Shared libraries those jobs need go in
|
|
`RUNNER_APT_PACKAGES` (e.g. `libatomic1`, without which the Node 26 that
|
|
`actions/setup-node` installs fails with `libatomic.so.1: cannot open shared
|
|
object file`). A VM without Tailscale can
|
|
still be set up from the Proxmox host: `qm guest exec <vmid> -- 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 <host>
|
|
```
|
|
|
|
`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/<host>.env`, commit, then `git pull &&
|
|
sudo ./install.sh <host>`. 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 <host> --from <dir containing .runner>`.
|