Bosun
A Go daemon that keeps a warm pool of one-job GitHub Actions runners in Cloud Hypervisor microVMs. No host runs it.
Bosun is a Go daemon, run as a NixOS service, that keeps GitHub Actions runners for this repository booted and waiting in microVMs. No host imports its module, so no runner from Bosun exists.
Terms#
| Term | Meaning |
|---|---|
| skiff | A Cloud Hypervisor microVM that runs one job and then halts |
| hull | The kernel, initrd and hull.json manifest that a skiff boots from |
| class | What a runs-on: label resolves to: a hull, vCPUs, memory, an optional scratch disk, and the number of warm skiffs |
How it works#
For each class, Bosun keeps a set number of skiffs booted. Each skiff registers with GitHub as a just-in-time (JIT) runner, and GitHub gives it a matching job. When a skiff halts, Bosun boots a replacement. Bosun has no inbound endpoint.
A job runs as root in the guest, and the microVM is the isolation boundary. Bosun passes the JIT config to the guest on a virtiofs share, and deletes it when the runner comes online. The systemd unit denies private, link-local and tailnet addresses to every skiff.
With services.bosun.kthxEngine set, Bosun also claims kthx builds and boots a build hull for each claim.
What is in the tree#
apps/bosun/: the daemon and its NixOS module..github/workflows/go.ymlruns its tests.- To run Bosun, a host imports
apps/bosun/module.nixand setsservices.bosun.enableandrepo. It setsgithub.appId, pointsgithub.privateKeyFileat the key innix/secrets/bosun.sops.yaml, and declares a class. Add the host as a recipient of that file in.sops.yamlfirst. nix/images/hull-*.nix: the hulls, registered innix/hosts/default.nix.- Workflows in
.github/workflows/that run on a skiff label wait for a runner that does not exist. nix/secrets/bosun.sops.yaml: Bosun's key on the GitHub App that Bosun shares with kthx.terraform/network/cloudflare/kthx-engine.tf: routes the Bosun build queue,/internal/bosun/onkthx-engine.lolwtf.dev, to the kthx engine.clusters/base/monitoring/grafana-dashboards/bosun.json: a dashboard on both clusters, with no data.
Linked from 3
- Built appsA kthx built app is a repository or archive that kthx builds into a signed artifact and deploys to Targets on the clusters, GCP, Vercel or Cloudflare.
- Ingress and DNSThe Gateways, DNS records, certificates, tunnels and lab resolvers that give cluster services a name and a path from the LAN, tailnet or internet.
- GlossaryThe lab-specific terms that the wiki pages use, what each means, and the page that defines it.