#!/usr/bin/env bash # rig forgejo-runner install — Forgejo Actions runner as a systemd service # under an unprivileged user. Outbound-only (long-poll to the instance), no # inbound ports. Convergent toward --instance: re-running against the instance # the box is already on leaves it alone; a box registered to a DIFFERENT # instance is refused, never silently restarted on the old one. # # The GitHub sibling (runner-install.sh) refuses Docker outright: it converges # a fleet MACHINE, where `docker` group membership is root-equivalent and the # blast radius is the machine. This command's home is a ci-box TENANT, where # bootstrap-tenant.sh has already installed Docker and added the tenant user to # the group, and where the blast radius is a disposable guest with no inbound # path. Same trade, different machine, opposite answer — which is why this is a # separate command and not a flag on that one. set -euo pipefail HERE="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)" # shellcheck source=SCRIPTDIR/lib/forgejo-runner-config.sh . "$HERE/lib/forgejo-runner-config.sh" log() { printf 'rig-forgejo-runner: %s\n' "$*"; } warn() { printf 'rig-forgejo-runner: WARNING: %s\n' "$*" >&2; } die() { printf 'rig-forgejo-runner: ERROR: %s\n' "$1" >&2; exit "${2:-1}"; } # The default label map. `runs-on: ubuntu-latest` is what a workflow written # for GitHub says, so it must mean something here or every workflow needs # editing to migrate; catthehacker's image is the act/Forgejo ecosystem's # stand-in for GitHub's runner image. `docker` is the lean second option. # # Both are `docker://` — jobs run in CONTAINERS on the box's own dockerd, not # on the box itself. No docker-in-docker: the guide this came from stacks a # privileged dind sidecar with a plaintext tcp://…:2375 daemon to isolate jobs # from a shared CI server, and inside a box that boundary is already paid for. # # WHY act-22.04 (slim) for ubuntu-latest, not full-22.04 — measured 2026-08-01 # against ghcr manifests (#144): # act-22.04: ~0.55 GB compressed / ~2.2 GB on disk — no shellcheck # full-22.04: ~18.67 GB compressed / ~54.5 GB on disk — has shellcheck 0.8.0 # A normal box-class ci tenant cannot hold 54.5 GB (typical free space ~34 GB). # So ubuntu-latest stays slim, and workflows must not assume GitHub-image tools # (rig's own ci.yml installs shellcheck when missing). Operators who need the # full tool surface opt in with runs-on: ubuntu-latest-full — that label is # inert until matched, so boxes that never ask pay nothing. DEFAULT_LABELS='ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-22.04,ubuntu-latest-full:docker://ghcr.io/catthehacker/ubuntu:full-22.04,docker:docker://node:22-bookworm' # fetch_and_verify_sha256