hephaestus/scripts/runner-setup.sh
Local Dev 0424d2b4ab 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.
2026-10-05 01:59:40 +02:00

27 lines
1.2 KiB
Bash

#!/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