Hephaestus: a Forgejo Actions runner for the silentmode organisation

Release builds (Pithos's Linux packages first) were made by hand on a
production server. The runner takes them over. Jobs run in a private
docker-in-docker engine rather than the host's Docker, so a workflow
cannot reach the forgejo, postgres or caddy containers; one job at a
time on this one-CPU host. scripts/runner-setup.sh registers it.
This commit is contained in:
Local Dev 2026-10-05 01:59:40 +02:00
parent 937a14bb0b
commit 0424d2b4ab
2 changed files with 57 additions and 0 deletions

View file

@ -129,9 +129,39 @@ services:
auth-proxy:
condition: service_started
# --- Forgejo Actions -------------------------------------------------------
# Jobs run in a private Docker engine (docker-in-docker), never the host's,
# so a workflow cannot see or touch the forgejo/postgres/caddy containers.
# The runner is registered for the silentmode organisation only.
docker-in-docker:
image: docker:27-dind
privileged: true
restart: unless-stopped
command: ["dockerd", "-H", "tcp://0.0.0.0:2375", "--tls=false"]
expose:
- "2375"
volumes:
- dind-data:/var/lib/docker
runner:
image: data.forgejo.org/forgejo/runner:6.3.1
user: "0:0"
restart: unless-stopped
depends_on:
- docker-in-docker
environment:
DOCKER_HOST: tcp://docker-in-docker:2375
working_dir: /data
volumes:
- runner-data:/data
# waits for registration (/data/.runner) and the config written by scripts/runner-setup.sh
command: ["/bin/sh", "-c", "while [ ! -f /data/.runner ]; do sleep 30; done; sleep 5; exec forgejo-runner daemon --config /data/config.yml"]
volumes:
postgres-data:
forgejo-data:
auth-proxy-keys:
caddy-data:
caddy-config:
dind-data:
runner-data:

27
scripts/runner-setup.sh Normal file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Registers the Forgejo Actions runner (see the runner + docker-in-docker
# services in docker-compose.yml) for the silentmode organisation. Run once
# on the Hephaestus host from ~/hephaestus. Re-running replaces the
# registration with a new one; delete the old runner in the org settings.
#
# Labels: jobs that say `runs-on: linux-x64` (or ubuntu-latest) run in a
# node:22-bookworm container inside docker-in-docker, one at a time.
set -euo pipefail
cd "$(dirname "$0")/.."
NAME=${1:-hephaestus-linux}
LABELS="linux-x64:docker://node:22-bookworm,ubuntu-latest:docker://node:22-bookworm"
docker compose up -d docker-in-docker runner
TOKEN=$(docker compose exec -T -u git forgejo forgejo actions generate-runner-token --scope silentmode | tail -n 1 | tr -d '\r')
[ -n "$TOKEN" ] || { echo "no registration token" >&2; exit 1; }
docker compose exec -T runner sh -c "
set -e
cd /data
rm -f .runner
forgejo-runner register --no-interactive --instance https://code.silentmode.st --token '$TOKEN' --name '$NAME' --labels '$LABELS'
forgejo-runner generate-config > config.yml
sed -i 's/^ capacity: .*/ capacity: 1/' config.yml
"
docker compose restart runner
sleep 8
docker compose logs --tail 20 runner