runner-warden

module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: Apache-2.0

README

runner-warden

Autoscaling manager for self-hosted GitHub Actions runners on your own machines. One daemon serves the orgs and repos you add with fresh, one-job runners, sized by real memory and CPU use, on its host and on other machines it drives over SSH.

⚠️ Runners use the host Docker daemon, which is root-equivalent. Only serve repos whose workflows you trust. See SECURITY.md.

What it does

Feature How
One label per OS Workflows use runs-on: <prefix>-linux, <prefix>-windows or <prefix>-macos
Fresh runner per job Ephemeral JIT runners; nothing persists between jobs except shared caches
Memory- and CPU-aware autoscaling One memory budget (a systemd slice hard cap, never throttled) and one CPU budget per host. A job that doesn't fit waits in GitHub's queue, where its timeout isn't ticking, while smaller jobs keep flowing
Busy repo uses the whole box Work-conserving; fair sharing only when repos compete
container: / services: / docker build Sibling containers through a per-runner Docker proxy that labels, places and cleans up everything a job creates
Hung jobs Cancelled after no CPU/IO/output for hang.idle, or after hang.max_duration
Stale PR jobs Cancelled when the PR is merged/closed or the pushed branch is deleted
Runner lost mid-job Run cancelled immediately and the job re-run once
Shared caches Host dirs (npm, Go, pub, Gradle…) mounted into runners and job containers with a fixed uid
Windows dockurr/windows VMs on the same host, started on demand, and separate Windows machines over SSH; one job at a time each
Overflow Linux hosts Other Linux machines or WSL distros take the Linux jobs this host can't fit; the daemon installs and updates itself there
macOS A persistent tart VM on a Mac, driven over SSH; a fresh runner per job in the guest's GUI session (login keychain works)
One-command install runner-warden setup scans existing runners and workflows, installs the service, rewrites runs-on, retires old runners

Quick start

curl -fsSL https://raw.githubusercontent.com/kylepantall/runner-warden/main/packaging/install.sh | sh
sudo runner-warden setup --prefix my-ci --org my-org --repo me/tool

Then change workflows to runs-on: my-ci-linux (setup opens a PR per repo for you). runs-on: my-ci also works for Linux.

runner-warden is a single binary in /usr/local/bin: runner-warden --help lists every command, and sudo runner-warden update keeps it current. setup also enables runner-warden-update.timer, which runs update daily around 04:00–06:00 (setup --auto-update=false turns it off).

Needs: Linux with systemd and cgroup v2, Docker 25+, gh logged in as a user with repo (+ admin:org for orgs, workflow for the label sweep).

Commands

Command Does
setup Install or update an instance (idempotent; --dry-run shows the plan)
status [--once|--json] Live view of lanes, held/running jobs, memory and runners (--once / --json for a snapshot)
check Health check of service, slice, Docker, disk, daemon
logs [-f] [runner|run-id] Service logs, filtered
drain [--off] Stop taking new jobs; running jobs finish
kill <runner> Cancel a runner's job and stop it
migrate apply|retire|rollback Label sweep and retirement of old runners
migrate check [--save] Re-scan for jobs still on old labels (e.g. branches older than the sweep); exit 3 if any, so it can run from cron or CI
windows provision|adopt <vm> Create a Windows VM, or take over an existing dockurr disk
windows host-script|host-setup <host> Prepare a separate Windows machine as a host
config validate Validate the config
update [--check] Update to the latest release (checksum + signature verified), then restart instances; running jobs survive
uninstall [--purge] Stop the service, delete its scale sets, containers, VM containers and slice; --purge also removes config, token and state

Configuration

/etc/runner-warden/<instance>/config.toml — see docs/configuration.md.

How scheduling works

Each repo/org and OS gets several "lane" scale sets sharing one label. Each lane holds at most one job that hasn't started yet, so the manager always knows which job the next runner will get. A job that fits the budget gets a runner immediately; one that doesn't goes to a free remote host if one serves it, or stays queued on GitHub without blocking the other lanes. Remote hosts reserve nothing on this host. Details: PLAN.md and spike/M0-FINDINGS.md.

Status

Pre-1.0. Linux (local and remote hosts), Windows (local VMs and remote hosts) and macOS (tart on remote Macs).

Licensed under Apache-2.0.

Directories

Path Synopsis
cmd
runner-warden command
Command runner-warden manages ephemeral self-hosted GitHub Actions runners.
Command runner-warden manages ephemeral self-hosted GitHub Actions runners.
internal
admission
Package admission holds the host-wide resource ledger (memory, shared CPU and whole physical-core pinning), cost-rule matching and the anti-starvation and fairness helpers the scheduler uses.
Package admission holds the host-wide resource ledger (memory, shared CPU and whole physical-core pinning), cost-rule matching and the anti-starvation and fairness helpers the scheduler uses.
assets
Package assets embeds files installed by `runner-warden setup`.
Package assets embeds files installed by `runner-warden setup`.
backend/docker
Package docker is the Linux core.Backend: one ephemeral runner per container on the host Docker daemon, with a per-runner Docker API proxy so the jobs the runner starts are labelled, capped by the instance slice and cleaned up.
Package docker is the Linux core.Backend: one ephemeral runner per container on the host Docker daemon, with a per-runner Docker API proxy so the jobs the runner starts are labelled, capped by the instance slice and cleaned up.
backend/hostpool
Package hostpool combines this machine's backend for one OS with remote hosts.
Package hostpool combines this machine's backend for one OS with remote hosts.
backend/linuxhost
Package linuxhost runs Linux runners on separate machines.
Package linuxhost runs Linux runners on separate machines.
backend/tartvm
Package tartvm runs macOS runners in a persistent tart VM on a separate Mac, driven over SSH with `tart exec`.
Package tartvm runs macOS runners in a persistent tart VM on a separate Mac, driven over SSH with `tart exec`.
backend/winvm
Package winvm runs Windows runners in persistent dockurr/windows VM containers: one container per [[windows.vm]], one ephemeral JIT runner per job, started in the guest over SSH as a one-shot Scheduled Task.
Package winvm runs Windows runners in persistent dockurr/windows VM containers: one container per [[windows.vm]], one ephemeral JIT runner per job, started in the guest over SSH as a one-shot Scheduled Task.
config
Package config loads and validates an instance's config.toml.
Package config loads and validates an instance's config.toml.
core
Package core holds the types and interfaces shared by every runner-warden package.
Package core holds the types and interfaces shared by every runner-warden package.
daemon
Package daemon wires the scale-set listeners, the scheduler, the backends and the control/hook servers into the long-running service.
Package daemon wires the scale-set listeners, the scheduler, the backends and the control/hook servers into the long-running service.
dockerproxy
Package dockerproxy is the per-runner Docker API proxy.
Package dockerproxy is the per-runner Docker API proxy.
github
Package gh talks to GitHub: scale-set API, listener, and REST helpers.
Package gh talks to GitHub: scale-set API, listener, and REST helpers.
hookapi
Package hookapi is the daemon's local HTTP-over-unix-socket protocol.
Package hookapi is the daemon's local HTTP-over-unix-socket protocol.
imagegc
Package imagegc is the only path that prunes Docker images and build cache.
Package imagegc is the only path that prunes Docker images and build cache.
migrate
Package migrate moves a host from legacy self-hosted runners to runner-warden: scanning, rewriting `runs-on` labels, applying the rewrite (print, PR or push), and retiring legacy local runners.
Package migrate moves a host from legacy self-hosted runners to runner-warden: scanning, rewriting `runs-on` labels, applying the rewrite (print, PR or push), and retiring legacy local runners.
naming
Package naming is the only place that derives names from the prefix.
Package naming is the only place that derives names from the prefix.
platform/linux
Package linux holds Linux host setup: the systemd job slice and read-only checks of the Docker daemon configuration.
Package linux holds Linux host setup: the systemd job slice and read-only checks of the Docker daemon configuration.
pulllock
Package pulllock is the cross-process gate between image pulls (held shared by every runner's Docker proxy, which lives in its own process) and image GC (held exclusively around a prune pass).
Package pulllock is the cross-process gate between image pulls (held shared by every runner's Docker proxy, which lives in its own process) and image GC (held exclusively around a prune pass).
repoconf
Package repoconf reads a repo's .github/runner-warden.yml, which lets a project pick the runner image its jobs run in:
Package repoconf reads a repo's .github/runner-warden.yml, which lets a project pick the runner image its jobs run in:
scheduler
Package scheduler implements the lane state machine: each (target, OS) has several lane scale sets, every lane exposes at most one unstarted job (capacity = started + 1), and a host-wide admission ledger decides when a runner may be started for that job.
Package scheduler implements the lane state machine: each (target, OS) has several lane scale sets, every lane exposes at most one unstarted job (capacity = started + 1), and a host-wide admission ledger decides when a runner may be started for that job.
store
Package store is the instance's SQLite state: ownership metadata, runner records, job history and the setup/migration journal.
Package store is the instance's SQLite state: ownership metadata, runner records, job history and the setup/migration journal.
spike
m0 command
Command m0 is the M0 spike: a throwaway scale-set listener that starts one ephemeral runner container per job and logs everything needed to answer the M0 questions (auth, message contents, hook ordering, sibling Docker jobs, name limits).
Command m0 is the M0 spike: a throwaway scale-set listener that starts one ephemeral runner container per job and logs everything needed to answer the M0 questions (auth, message contents, hook ordering, sibling Docker jobs, name limits).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL