forgejo: dedicated deploy-arm64 runner so CI cannot starve site deploys

deploy-site.yml must run on the Pi (127.0.0.1:5000 registry, Garage on host
network, host docker socket) but the Pi's only runner also serves every
runs-on: docker job in the instance. An onionwire Rust ci build therefore held
the single docker slot while the sirius-growth deploy sat in 'waiting'.

Adds a second runner instance on rpi declaring only the deploy-arm64 label,
with its own hostPath-backed registration (/opt/siriusdevops/runner-deploy/data)
so a pod restart reuses it instead of burning a single-use runner token.
This commit is contained in:
Sirius DevOps 2026-10-22 23:52:54 -04:00
commit 1576240941
3 changed files with 169 additions and 0 deletions

View file

@ -10,3 +10,4 @@ resources:
- runner-configmap.yaml
- runner-arm64.yaml
- runner-amd64.yaml
- runner-deploy-arm64.yaml

View file

@ -30,6 +30,34 @@ data:
options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock
valid_volumes:
- "**"
# Dedicated runner for site deploys. It declares ONLY the `deploy-arm64`
# label, so `runs-on: docker` CI jobs (onionwire ci, minutes to hours of Rust)
# can never occupy it and starve a deploy. The converse also holds: a deploy
# can never occupy the Pi's `docker` runner, whose capacity 1 exists to
# serialize onionwire jobs sharing the onionwire-target-ci volume.
#
# It runs on the Pi because deploy-site.yml needs Pi-local resources:
# 127.0.0.1:5000 (registry), 127.0.0.1:3900 (Garage) via `--network host`,
# and the host docker socket to build the arm64 site image.
deploy-arm64.toml: |
log:
level: info
runner:
file: /data/runner.ini
capacity: 1
timeout: 30m
cache: /data/cache
cache:
enabled: true
dir: /data/cache
container:
privileged: true
# Same injection as arm64.toml: the job container is node:20-bullseye,
# which has no docker CLI and no buildx, and deploy-site.yml needs both.
options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock
valid_volumes:
- "**"
amd64.toml: |
log:
level: info

View file

@ -0,0 +1,140 @@
---
# Second Forgejo Actions runner instance on the Pi, declaring ONLY the
# `deploy-arm64` label.
#
# Why: the Pi's original runner (forgejo-runner-arm64) serves every
# `runs-on: docker` job in the instance, so a long onionwire `ci` build (Rust,
# 20-40 min) holds the only `docker` slot and any site deploy queued behind it
# waits indefinitely - that is exactly how siriusgrowthsolutions.com sat on a
# stale page while deploy-site runs stayed in `waiting` (runs 1163/1164).
#
# Deploys are not CPU-bound the way CI is, so a separate runner instance is
# cheap; the labels are disjoint in both directions, so neither class can
# starve the other. Keep capacity 1: a deploy must not overlap itself (the Pi
# registry tag :latest and the k8s restartedAt patch are last-writer-wins).
apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo-runner-deploy-arm64
namespace: forgejo
labels:
app: forgejo-runner
arch: arm64
role: deploy
spec:
replicas: 1
selector:
matchLabels:
app: forgejo-runner
role: deploy
strategy:
type: Recreate
template:
metadata:
labels:
app: forgejo-runner
arch: arm64
role: deploy
spec:
nodeSelector:
kubernetes.io/hostname: rpi
tolerations:
- key: dedicated
operator: Equal
value: network
effect: PreferNoSchedule
securityContext:
supplementalGroups: [984]
initContainers:
# Self-registration, like the amd64 runner. runner.ini lives on the Pi
# host (/opt/siriusdevops/runner-deploy/data) so a pod restart reuses the
# existing registration instead of burning a single-use runner token.
- name: register
# Must be the multi-arch code.forgejo.org image: alex3305/
# forgejo-runner-dind ships an x86-64 binary in its arm64 manifest and
# dies with "exec format error" on the Pi.
image: code.forgejo.org/forgejo/runner:5.0.1
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
set -e
if [ -s /data/runner.ini ]; then
echo already-registered
exit 0
fi
forgejo-runner register --no-interactive \
--instance https://forgejo.siriusdevops.com \
--token "$RUNNER_TOKEN" \
--name pi-deploy-arm64 \
--labels 'deploy-arm64:docker://node:20-bullseye' \
--config /config/config.toml
env:
- name: RUNNER_TOKEN
valueFrom:
secretKeyRef:
name: forgejo-runner-deploy-arm64-token
key: token
volumeMounts:
- name: config-toml
mountPath: /config/config.toml
subPath: deploy-arm64.toml
- name: data
mountPath: /data
containers:
- name: runner
image: code.forgejo.org/forgejo/runner:5.0.1
imagePullPolicy: IfNotPresent
command:
- forgejo-runner
- --config
- /config/config.toml
- daemon
env:
- name: DOCKER_HOST
value: unix:///var/run/docker.sock
securityContext:
privileged: true
runAsUser: 0
runAsGroup: 0
volumeMounts:
- name: docker-sock
mountPath: /var/run/docker.sock
- name: docker-static
mountPath: /usr/bin/docker
readOnly: true
- name: cli-plugins
mountPath: /usr/local/lib/docker/cli-plugins
readOnly: true
- name: config-toml
mountPath: /config/config.toml
subPath: deploy-arm64.toml
- name: data
mountPath: /data
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
memory: 512Mi
volumes:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
type: Socket
- name: docker-static
hostPath:
path: /usr/local/bin/docker-static
type: File
- name: cli-plugins
hostPath:
path: /opt/siriusdevops/runner/cli-plugins
type: DirectoryOrCreate
- name: config-toml
configMap:
name: forgejo-runner-config
- name: data
hostPath:
path: /opt/siriusdevops/runner-deploy/data
type: DirectoryOrCreate