Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

WILDZERG Runbook

The deploy / upgrade / rollback runbook for WILDZERG — the self-hosted, on-prem variant provisioned from the wild blueprint (runit + podman + OpenResty GitOps). This page describes the flow the CD actually executes; day-2 operations (incident response, monitoring, recovery) live in the Production Runbook.

The deployment model

Production WILDZERG runs on Debian 13 with runit supervision (runit/sv/zerg-* services), podman containers (no Docker — Docker is banned), and OpenResty for TLS. Deployment is GitOps: the state the host runs is encoded in the wild repo’s runit/sv/$svc/env/IMAGE files. Crow CI (.crow.yml, CROW_BACKEND=podman) is the autonomous CD pipeline:

a signed, semantic-version tag push (git tag -s vX.Y.Z) runs the full build → gate → deploy → promote chain; a main push runs only the build-side DRY-RUN lane (docs-hygiene, fetch-grammars, build-images, build-reproducibility).

The wild repo (WILD_REF)

wild is a separate repository, not part of this tree:

Clone URL: https://git.zergs.net/spacebeam/wild.git Pin semantics: the release pipeline clones wild pinned to the 40-hex SHA in this repo’s ci/wild-pin (git clone … && git checkout $(cat ci/wild-pin)). Every wild clone in .crow.yml uses this form and fails loudly on an unpinned clone; the release commit flips the pin, and a placeholder pin fails on purpose. Deploy-lane semantics: the deploy lane is pinned too — before invoking the deploy script, deploy-staging resets blue’s wild checkout to the ci/wild-pin SHA (git fetch origin && git reset --hard $WILD_REF), so a wild main push landing between the pin and the deploy can never run scripts the release never validated. HEAD-tracking returns only under the explicit operator override CROW_ALLOW_WILD_HEAD=1 (audited in the pipeline log). The source of truth for wild’s own model (topology, provisioning scripts, deploy paths) is wild/AGENTS.md inside that repo.

Install (first host)

Provisioning is wild’s job — do not hand-roll systemd units or manual deploys on a production host (the systemd-era and on-host models ended with the deploy decommission; deployment/ is archived). The flow:

  1. Clone wild at the pinned revision (git checkout $(cat ci/wild-pin)) and follow wild/AGENTS.md + wild/scripts/provision/ for host provisioning (runit services, podman networking, OpenResty sites).
  2. Provision PostgreSQL via wild’s scripts/provision/create-postgres.sh; the legacy Docker-era Postgres is migrated, not copied.
  3. Mirror branch protection: the required CI checks are mirrored on the Forgejo repo by wild’s scripts/provision/configure-zerg-repo.sh — the authoritative list is ci/branch_protection_lint.py REQUIRED_CHECKS.
  4. One-time Crow prerequisites (top of .crow.yml): enable the volumes feature for the repo, forgejo_token secret (Forgejo admin token), deploy key authorized on blue (port 122, /root/.ssh/authorized_keys), SSH config at /fun/secrets/crow/ssh-config (port 122, root user), registry auth at /fun/secrets/registry/auth.json.

These are wired by wild’s configure-crow-cd.sh. 5. Provision the minisign signing key for update-channel signing via wild’s scripts/release/gen-minisign-key.sh (mounted read-only into publish-release at /fun/secrets/minisign).

Provision (first deploy of a running stack)

WILDZERG is delivered as images, not source installs:

The CD builds 8 images (IMAGES="sol mango luna limon-web toronja-web starfruit-web docs-web cli") and pushes them to the internal registry (registry.nonsense.ws, internal-only). Services are the runit services zerg-sol, zerg-mango, zerg-luna (+ openresty, grafana, forgejo, crow-server/crow-agent, tempo); each runs a pinned image tag from runit/sv/$svc/env/IMAGE. First deploy on a fresh host = run the same path the CD runs (see Upgrade below) or follow wild’s provisioning scripts. If you must exercise the deploy logic by hand, the entry point is sh scripts/release/deploy-zerg.sh from the host’s own wild checkout (reset to the pinned revision first: git fetch origin && git reset hard $(cat ci/wild-pin); CROW_ALLOW_WILD_HEAD=1 is the audited HEAD override) — the script asserts the RUNNING images match the committed env/IMAGE and owns verify + rollback.

Shipped state roots, transport default & restore

The release renders its state under the configured data root (the standalone default is /var/lib/sol/data; a container boot derives it from SOL_DATA_DIR): data_dir (Curve keyfile, scheduler store, managed settings, provider key store), mnesia_dir (/var/lib/sol/data/mnesia), mnesia_backup_dir (/var/lib/sol/data/mnesia_backups), and the audit chain (/var/lib/sol/data/logs + /var/lib/sol/data/audit-data).

SOL_ZMQ_BIND_ADDR defaults to 127.0.0.1; a remote-worker fleet opts in to 0.0.0.0 and then needs CURVE (automatic on a non-loopback bind) or an explicit plaintext ack. A prod boot refuses blank SOL_AUTH_TOKENS, SOL_MANGO_SERVICE_TOKEN, or (audit enabled) SOL_AUDIT_HMAC_SECRET — server/rel/sol-preflight.sh fails first with the same reasons.

Backup is sol_mnesia_backup (never raw mnesia:backup); the artifact bundle deliberately EXCLUDES the CURVE private key (SEC-X2), so reprovision workers from sol_zmq_curve:provisioning_info/0 after a node rebuild. Restore with Sol stopped via scripts/sol-restore.sh --sol-root /opt/sol yes (offline entry point — restore_latest/1 only exists in a running app). Single order: Mango -> Sol memory PG -> Mnesia -> Luna -> the data_dir operator copy set (see Backup & DR).

Upgrade

Upgrades are tag-triggered: push a signed semantic tag and Crow runs the chain. Everything between push and “new version live” is the pipeline:

Step (name in .crow.yml)What it does
verify-tagRequires vX.Y.Z + git verify-tag (signed tag; GPG key baked into the build image). Untagged runs need CROW_ALLOW_UNTAGGED=1.
docs-hygieneClones corp + wild (pinned), greps for banned words/dead claims; gates releases on doc truth.
fetch-grammarsRegenerates tree-sitter grammars via wild’s scripts/release/fetch-grammars.sh (pinned clone).
ci-status-checkRequires every branch-protection required check to be success at the tag commit.
branch-protection-liveDiffs the LIVE forge branch-protection required-check set against ci/required_checks.sha256 (ci/required_checks_mirror_diff.py); a narrowed/hand-edited protection fails the release. Read-only FORGE_PROTECTION_TOKEN (falls back to FORGEJO_TOKEN).
build-imagesBuilds the 8 images hermetically from the pinned wild checkout.
build-enginesBuilds the local-inference engine bundles (scripts/engines/build.sh); verifies the scp’d tarballs (sha256sum -c) before publish.
supply-chainCosign/minisign + SBOM/attestation gates over the just-pushed digests.
push-stagingPushes a per-run EPHEMERAL tag only and records the per-image manifest digests to ci-digests.env (registry v2 API, ci/registry-digest.sh). No :<version>/:staging tag exists yet.
build-reproducibilityDeterministic-build gate bound to the PUSHED bytes (_repro-shipped/).
smoke-stagingEnd-to-end smoke against the staging stack.
kill-proofs-checkWaits for the tag’s kill-proofs workflow run and requires the committed-TSV verdict + PASS floor (ci/kill_proofs_gate.py --wait-run, 120-min internal deadline).
release-tagRe-pulls every recorded digest, signs the DIGEST (not a mutable tag), runs ci/verify.sh --digest-only (cosign + mandatory attestation + trivy CRITICAL), then creates/pushes :<version> and moves :staging — each asserted against registry truth.
deploy-stagingGitOps: for zerg-sol/mango/luna copies IMAGE → IMAGE.prev, writes the new version, pushes wild main; then on blue resets to the pinned wild revision (ci/wild-pin; CROW_ALLOW_WILD_HEAD=1 is the audited override), deploys by the resolved version, and verifies /api/v1/ready with automatic rollback on failure.
heartbeat-probeRuns check-alerting-provisioning.sh (env + canonical artifacts; Slack demoted only by the dated register row) and then heartbeat-probe.sh against the live Grafana: dead-man rules exist/evaluate/fresh, contact-point credentials, and severity=critical routes to the pager.
relaunch-clusterDeploys the pinned scripts to green/red, relaunches both nodes, and asserts the 3-node Erlang cluster (3/3).
promote-prodPURE TAG CEREMONY: captures the previous-good :prod digest per image from REGISTRY TRUTH into ci-prod-prev.env (a first promote needs CROW_ALLOW_FIRST_PROMOTE naming THIS run’s version), pulls each recorded digest, cosign-verifies post-pull, tags :prod, then asserts every :prod resolves to the recorded digest. A mid-loop failure restores the already-promoted images from ci-prod-prev.env. No :prod-prev tag exists.
publish-releaseCreates/updates the Forgejo release (wild’s release-notes.sh, idempotent) and uploads the redistributable assets (zerg CLI, luna, sol-<ver>.tar.gz, SHA256SUMS + minisign signatures) via wild’s publish-release.sh --version V --tag TAG.

Operator trigger (manual): the tag push is the trigger; if you must run the chain by hand, wild’s scripts/release/cd-trigger.sh on blue starts a Crow run.

Rollback

Rollback exists at three levels:

  1. Automatic (deploy failure): deploy-zerg.sh verifies /api/v1/ready (19 subsystem checks — not the always-200 /health liveness) and flips IMAGE back to IMAGE.prev for the failed services, re-runs the deploy, and exits non-zero.
  2. Automatic (promote failure): the already-promoted images are restored to the digests captured in the pipeline workspace file ci-prod-prev.env (registry truth — there is NO :prod-prev tag; retired ). scripts/release/promote-rollback-drill.sh exercises the real restore path.
  3. Manual (operator): on the host — cp runit/sv/$svc/env/IMAGE.prev runit/sv/$svc/env/IMAGE, commit + push the wild flip, then git pull --ff-only && sh scripts/release/deploy-zerg.sh, and verify curl -sf https://api.nonsense.ws/api/v1/ready.

Mnesia data rollback is separate from image rollback: restores require Sol stopped and use the Mnesia backup path — see Backup & DR.

Day-2 operations

Liveness vs readiness: GET /health is the liveness probe; GET /api/v1/ready runs 19 subsystem checks and returns 503 when degraded. Maintenance mode: POST /api/v1/infra/maintenance/enable drains traffic during deploys. Monitoring: Grafana + Prometheus run as podman containers supervised by runit; dashboards + alert rules are canonical in observability/ in this repo — see the Production Runbook for procedures. Air-gap: WILDZERG is air-gap capable — see Air-Gap Install.

What wild owns

The wild repo owns: the exact runit service definitions (runit/sv/zerg-*/run), the OpenResty site configs (runit/sv/openresty/conf/sites/*.conf), image entrypoints (images/zerg/*/entrypoint.sh — sys.config/vm.args generation), the provisioning script set (scripts/provision/) and the podman runner settings (e.g. WILD_PODMAN_MEMORY). These are cited by name only — clone wild and read it; do not infer specifics not visible here.

See also

Production Runbook — day-2 procedures (monitoring, troubleshooting, recovery, SLOs) Deployment — deployment options overview Backup & DR — full-state backup & restore Air-Gap Install — offline posture + egress gates