bootstrap reseed pipeline: CI publishes the agent artifact, the mail droplet pulls — plus the get.idss.nz pin-policy ADR #601

Closed
opened 2026-08-19 22:02:27 +00:00 by ben · 5 comments
Owner

Problem

get.idss.nz's served agent is reseeded by hand, and only Ben's laptop can do it (the artifacts dir is root-owned on the mail droplet; the workstation provably cannot SSH there — #597 and #598 both dead-ended ready-for-human on exactly this wall). Result on 2026-08-19: the pin sat 4 days stale, drives went red on an already-fixed bug, and two writers (a deliberate ADR 0181 re-stage to 75dfba9, then the 95c428f-era reseed) had no shared rule for what the pin should be.

Ruling needed first (the ADR)

Pin policy for get.idss.nz. ADR 0051/0100 posture is a pinned release, fail-loud when unseeded. Auto-tracking main quietly turns the pin into a mirror — and whatever this endpoint serves is installed as root-level code on real machines, so "swarm commit → live install endpoint, ungated" is a supply-chain decision, not a workflow tweak. Options to rule between:

  • A. Tracking pin (proposed for the rehearsal era): pin = newest main that passed CI; automation moves it; the pin remains explicit (a RELEASE file naming one sha) and every move is logged + announced. Revisit before real-customer installs.
  • B. Human-advanced pin: automation stages and alerts but a human command advances the pin. Safer, keeps today's latency problem in smaller form.
  • C. Channels: main-tracking staging pin for drives + human-advanced production pin. Most future-proof, most machinery.

Mint the ADR from the then-current sequence when this lands; record the choice and its revisit trigger (first non-rehearsal install).

What to build (shape: CI publishes, droplet pulls — no new inbound doors)

  1. Publish half (Forgejo Actions, workstation runner): on push to main where tests are green and the change touches the agent-affecting set (agent/, go.mod, go.sum, agent-imported internal/), build CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./agent/cmd/agent and publish agent-x86_64 + its sha256 + the git sha as a Forgejo release/package asset (Forgejo generic package registry is the natural home; token = the swarm machine PAT, write scope on packages only).
  2. Pull half (systemd timer ON the mail droplet): poll the package endpoint over outbound HTTPS (a door the droplet already has), compare against the current RELEASE; when policy says advance: download, verify sha256, install binary (0755) + RELEASE (0644) into /opt/ourcloud-bootstrap/artifacts/, then self-probe x-ourcloud-release and log the move. Runs as root or a dedicated user with write on the artifacts dir — rule which during implementation.
  3. Staleness alarm (independent of policy choice): the same timer posts to Mattermost when the served release falls behind by more than N agent-affecting commits or M days — stale serving must be loud, never silent. This alone would have caught the 4-day slide.
  4. Deliberate re-stages get an interface: a PIN override file (or pin <sha> subcommand) so work like ADR 0181's script-staging pins intentionally through the mechanism, visibly, instead of around it — and the alarm still fires if an override goes stale.

Why human

  • The pin-policy ADR is Ben's ruling (supply-chain posture, ADR 0051 interaction).
  • Droplet-side install is Ben's hands once: the timer unit + its credentials/permissions on a host only Ben can reach. After that, no reseed should ever need a human again (policy A/C) or needs only a one-line command (policy B).

Companion: #600 (drive-preflight staleness gate) is the cheap guard that protects drives under ANY pin policy and needs no infra — it should land regardless.

Evidence trail: #597, #598 (closed 2026-08-19, reseed proof on #598's close comment), rehearsal-183 red chain #581→#595→#597→#598.

## Problem get.idss.nz's served agent is reseeded by hand, and only Ben's laptop can do it (the artifacts dir is root-owned on the mail droplet; the workstation provably cannot SSH there — #597 and #598 both dead-ended `ready-for-human` on exactly this wall). Result on 2026-08-19: the pin sat 4 days stale, drives went red on an already-fixed bug, and two writers (a deliberate ADR 0181 re-stage to `75dfba9`, then the `95c428f`-era reseed) had no shared rule for what the pin should be. ## Ruling needed first (the ADR) **Pin policy for get.idss.nz.** ADR 0051/0100 posture is a *pinned* release, fail-loud when unseeded. Auto-tracking `main` quietly turns the pin into a mirror — and whatever this endpoint serves is installed as root-level code on real machines, so "swarm commit → live install endpoint, ungated" is a supply-chain decision, not a workflow tweak. Options to rule between: - **A. Tracking pin (proposed for the rehearsal era):** pin = newest `main` that passed CI; automation moves it; the pin remains explicit (a `RELEASE` file naming one sha) and every move is logged + announced. Revisit before real-customer installs. - **B. Human-advanced pin:** automation *stages and alerts* but a human command advances the pin. Safer, keeps today's latency problem in smaller form. - **C. Channels:** `main`-tracking staging pin for drives + human-advanced production pin. Most future-proof, most machinery. Mint the ADR from the then-current sequence when this lands; record the choice and its revisit trigger (first non-rehearsal install). ## What to build (shape: CI publishes, droplet pulls — no new inbound doors) 1. **Publish half (Forgejo Actions, workstation runner):** on push to `main` where tests are green and the change touches the agent-affecting set (`agent/`, `go.mod`, `go.sum`, agent-imported `internal/`), build `CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./agent/cmd/agent` and publish `agent-x86_64` + its sha256 + the git sha as a Forgejo release/package asset (Forgejo generic package registry is the natural home; token = the swarm machine PAT, write scope on packages only). 2. **Pull half (systemd timer ON the mail droplet):** poll the package endpoint over outbound HTTPS (a door the droplet already has), compare against the current `RELEASE`; when policy says advance: download, verify sha256, `install` binary (0755) + `RELEASE` (0644) into `/opt/ourcloud-bootstrap/artifacts/`, then self-probe `x-ourcloud-release` and log the move. Runs as root or a dedicated user with write on the artifacts dir — rule which during implementation. 3. **Staleness alarm (independent of policy choice):** the same timer posts to Mattermost when the served release falls behind by more than N agent-affecting commits or M days — stale serving must be loud, never silent. This alone would have caught the 4-day slide. 4. **Deliberate re-stages get an interface:** a `PIN` override file (or `pin <sha>` subcommand) so work like ADR 0181's script-staging pins intentionally *through* the mechanism, visibly, instead of around it — and the alarm still fires if an override goes stale. ## Why human - The pin-policy ADR is Ben's ruling (supply-chain posture, ADR 0051 interaction). - Droplet-side install is Ben's hands once: the timer unit + its credentials/permissions on a host only Ben can reach. After that, no reseed should ever need a human again (policy A/C) or needs only a one-line command (policy B). Companion: `#600` (drive-preflight staleness gate) is the cheap guard that protects drives under ANY pin policy and needs no infra — it should land regardless. Evidence trail: #597, #598 (closed 2026-08-19, reseed proof on #598's close comment), rehearsal-183 red chain #581→#595→#597→#598.
Author
Owner

Ben ruled (2026-08-19, live session): option A — tracking pin, for the rehearsal era.

  • Pin = newest main that passed CI where the change touches the agent-affecting set; automation moves it. The pin stays explicit (RELEASE names one sha), every move is logged and announced (Mattermost), never a silent mirror.
  • Revisit trigger recorded in the ADR: the first non-rehearsal install — before any real-customer machine consumes this endpoint, the policy is re-ruled (expected landing: option C, a human-advanced production channel beside the tracking staging pin). Today the endpoint's only consumers are throwaway rehearsal droplets, and 2026-08-19 proved the loop stalls without a tracking pin (three stale-stage reds in one evening: #595, #598, #603).
  • The staleness alarm (item 3) and the deliberate-override interface (item 4, PIN override that still alarms when stale) land regardless, per the ticket.
  • Mint the ADR from the then-current next-free number — check origin/main's docs/adr/ first (tonight alone consumed 0180–0182).
  • Build both halves agent-side; the droplet-side timer install remains Ben's hands ONCE — when the unit + credentials are ready, comment here with the exact install ritual for Ben's !. Until the pipeline is live, stale-stage reds keep routing through #600's preflight gate + manual re-stage.

Armed ready-for-agent.

**Ben ruled (2026-08-19, live session): option A — tracking pin, for the rehearsal era.** - Pin = newest `main` that passed CI where the change touches the agent-affecting set; automation moves it. The pin stays **explicit** (RELEASE names one sha), every move is logged and announced (Mattermost), never a silent mirror. - **Revisit trigger recorded in the ADR: the first non-rehearsal install** — before any real-customer machine consumes this endpoint, the policy is re-ruled (expected landing: option C, a human-advanced production channel beside the tracking staging pin). Today the endpoint's only consumers are throwaway rehearsal droplets, and 2026-08-19 proved the loop stalls without a tracking pin (three stale-stage reds in one evening: #595, #598, #603). - The staleness alarm (item 3) and the deliberate-override interface (item 4, `PIN` override that still alarms when stale) land regardless, per the ticket. - Mint the ADR from the then-current next-free number — check `origin/main`'s `docs/adr/` first (tonight alone consumed 0180–0182). - Build both halves agent-side; the droplet-side timer install remains Ben's hands ONCE — when the unit + credentials are ready, comment here with the exact install ritual for Ben's `!`. Until the pipeline is live, stale-stage reds keep routing through #600's preflight gate + manual re-stage. Armed ready-for-agent.

Agent code landed — 9b56af3 on origin/main

Both halves built against your ruling (option A, tracking pin). ADR minted as 0185 (next-free on origin/main; 0184 was the last taken).

Landed:

  • docs/adr/0185-get-idss-nz-serves-a-tracking-pin-for-the-rehearsal-era.md — the policy + the revisit trigger (first non-rehearsal install → expected option C).
  • scripts/lib/bootstrap-reseed-lib.sh — pure decision core (target w/ PIN override, should-advance, git-free behind-count over the published version list, staleness alarm). Offline suite scripts/tests/bootstrap-reseed-test.sh — 20 checks green.
  • scripts/bootstrap-reseed/publish.sh — CI half: build agent-x86_64 + sha256 + RELEASE → Forgejo generic package registry, one immutable version per sha, self-guarded on the agent-affecting set (docs-only pushes never move the pin).
  • scripts/bootstrap-reseed/reseed.sh — droplet half: poll → verify sha256 → install → self-probe x-ourcloud-release → announce → staleness alarm. Subcommands run|status|pin <sha>|unpin.
  • ourcloud-reseed.service/.timer (5-min poll), README with the ritual, runbook updated.

Two residuals — both out of an agent's reach

  1. Publish-step wiring (.forgejo/workflows/ — protected path, #445): filed #606 ready-for-session. Until it lands nothing is published, so the pull half has nothing to advance to.
  2. Droplet timer install — your !, below. This issue is routed ready-for-human for it.

Droplet install ritual (your hands, once)

On the mail droplet (ssh dev@100.98.48.68), ourcloud checkout at /opt/ourcloud (adjust ExecStart in the unit if elsewhere):

# 1. secrets + config (0600). FORGEJO_TOKEN only if the package registry read needs auth.
sudo tee /etc/ourcloud-reseed.env >/dev/null <<EOF
MATTERMOST_URL=https://<chat host>
MATTERMOST_CHANNEL_ID=<channel id>
MATTERMOST_BOT_TOKEN=<bot token>
# FORGEJO_TOKEN=<read:package PAT>      # only if the registry is private
# RESEED_MAX_BEHIND=0  RESEED_MAX_DAYS=1  # alarm thresholds (defaults)
EOF
sudo chmod 0600 /etc/ourcloud-reseed.env

# 2. units. The service User= must own /opt/ourcloud-bootstrap/artifacts (root today,
#    per GOTCHAS — or grant a dedicated reseed user write on that dir and set User=).
sudo install -m0644 /opt/ourcloud/scripts/bootstrap-reseed/ourcloud-reseed.service /etc/systemd/system/
sudo install -m0644 /opt/ourcloud/scripts/bootstrap-reseed/ourcloud-reseed.timer   /etc/systemd/system/

# 3. dry-run, then arm
sudo /opt/ourcloud/scripts/bootstrap-reseed/reseed.sh status      # shows served/target/behind, no writes
sudo systemctl daemon-reload
sudo systemctl enable --now ourcloud-reseed.timer
sudo systemctl start ourcloud-reseed.service                      # first advance now
journalctl -u ourcloud-reseed.service -n 50 --no-pager

Note the ordering: #606 (publish wiring) should land first so there is a published version for the first reseed.sh run to advance to; if you install the timer before #606, status will show newest: <none published> and it will simply hold (no harm). A deliberate re-stage after this is live: sudo reseed.sh pin <sha> / unpin.

Once installed, no reseed needs a human again in the rehearsal era, and the staleness alarm makes any stuck advance loud within RESEED_MAX_DAYS. Veto the policy anytime via the ADR.

## Agent code landed — `9b56af3` on `origin/main` Both halves built against your ruling (option A, tracking pin). ADR minted as **0185** (next-free on `origin/main`; 0184 was the last taken). **Landed:** - `docs/adr/0185-get-idss-nz-serves-a-tracking-pin-for-the-rehearsal-era.md` — the policy + the revisit trigger (first non-rehearsal install → expected option C). - `scripts/lib/bootstrap-reseed-lib.sh` — pure decision core (target w/ PIN override, should-advance, **git-free** behind-count over the published version list, staleness alarm). Offline suite `scripts/tests/bootstrap-reseed-test.sh` — 20 checks green. - `scripts/bootstrap-reseed/publish.sh` — CI half: build `agent-x86_64` + sha256 + RELEASE → Forgejo generic package registry, one immutable version per sha, self-guarded on the agent-affecting set (docs-only pushes never move the pin). - `scripts/bootstrap-reseed/reseed.sh` — droplet half: poll → verify sha256 → install → self-probe `x-ourcloud-release` → announce → staleness alarm. Subcommands `run|status|pin <sha>|unpin`. - `ourcloud-reseed.service`/`.timer` (5-min poll), README with the ritual, runbook updated. ## Two residuals — both out of an agent's reach 1. **Publish-step wiring** (`.forgejo/workflows/` — protected path, #445): filed **#606** `ready-for-session`. Until it lands nothing is published, so the pull half has nothing to advance to. 2. **Droplet timer install** — your `!`, below. This issue is routed `ready-for-human` for it. ## Droplet install ritual (your hands, once) On the mail droplet (`ssh dev@100.98.48.68`), ourcloud checkout at `/opt/ourcloud` (adjust `ExecStart` in the unit if elsewhere): ```sh # 1. secrets + config (0600). FORGEJO_TOKEN only if the package registry read needs auth. sudo tee /etc/ourcloud-reseed.env >/dev/null <<EOF MATTERMOST_URL=https://<chat host> MATTERMOST_CHANNEL_ID=<channel id> MATTERMOST_BOT_TOKEN=<bot token> # FORGEJO_TOKEN=<read:package PAT> # only if the registry is private # RESEED_MAX_BEHIND=0 RESEED_MAX_DAYS=1 # alarm thresholds (defaults) EOF sudo chmod 0600 /etc/ourcloud-reseed.env # 2. units. The service User= must own /opt/ourcloud-bootstrap/artifacts (root today, # per GOTCHAS — or grant a dedicated reseed user write on that dir and set User=). sudo install -m0644 /opt/ourcloud/scripts/bootstrap-reseed/ourcloud-reseed.service /etc/systemd/system/ sudo install -m0644 /opt/ourcloud/scripts/bootstrap-reseed/ourcloud-reseed.timer /etc/systemd/system/ # 3. dry-run, then arm sudo /opt/ourcloud/scripts/bootstrap-reseed/reseed.sh status # shows served/target/behind, no writes sudo systemctl daemon-reload sudo systemctl enable --now ourcloud-reseed.timer sudo systemctl start ourcloud-reseed.service # first advance now journalctl -u ourcloud-reseed.service -n 50 --no-pager ``` **Note the ordering:** #606 (publish wiring) should land *first* so there is a published version for the first `reseed.sh run` to advance to; if you install the timer before #606, `status` will show `newest: <none published>` and it will simply hold (no harm). A deliberate re-stage after this is live: `sudo reseed.sh pin <sha>` / `unpin`. Once installed, no reseed needs a human again in the rehearsal era, and the staleness alarm makes any stuck advance loud within `RESEED_MAX_DAYS`. Veto the policy anytime via the ADR.

Why human

Agent code is landed and pushed (9b56af3). The remaining step is a one-way-door, hands-on install on a host only Ben can reach: the ourcloud-reseed.timer unit + its credentials/permissions on the mail droplet (root-owned artifacts dir — the exact wall #597/#598 dead-ended on). Ritual is in the comment above. The publish-side wiring is separately filed as #606 ready-for-session (protected .forgejo/ path). Routing to ready-for-human for the droplet install; Ben closes this once the timer is armed.

## Why human Agent code is landed and pushed (`9b56af3`). The remaining step is a **one-way-door, hands-on install on a host only Ben can reach**: the `ourcloud-reseed.timer` unit + its credentials/permissions on the mail droplet (root-owned artifacts dir — the exact wall #597/#598 dead-ended on). Ritual is in the comment above. The publish-side wiring is separately filed as **#606** `ready-for-session` (protected `.forgejo/` path). Routing to `ready-for-human` for the droplet install; Ben closes this once the timer is armed.
Author
Owner

Pull half LIVE on the droplet (2026-08-20 20:58Z). Ritual done by Ben via !: /opt/idss-bootstrap + idss-bootstrap.service (retired ourcloud-bootstrap), reseed scripts at /opt/idss/scripts/…, /etc/idss-reseed.env (Mattermost lines commented — add to get announcements), idss-reseed.timer armed (5 min). First live run surfaced two wrapper bugs the lib-only suite could not: b4fef9d (pin_override/served_sha tripped set -e with no PIN file — the unit exited 1 before logging; plus short-vs-full sha compare) and 8ca4a74 (RETURN trap leaked into cmd_run, tmp: unbound). The advance itself worked: downloaded, sha256 verified, installed, self-probed — public x-idss-release: 7a35076d55d7…. Suite now runs the wrapper offline (26 checks). Publish side: see #606 (token) and #621 (seam red).

**Pull half LIVE on the droplet (2026-08-20 20:58Z).** Ritual done by Ben via `!`: `/opt/idss-bootstrap` + `idss-bootstrap.service` (retired `ourcloud-bootstrap`), reseed scripts at `/opt/idss/scripts/…`, `/etc/idss-reseed.env` (Mattermost lines commented — add to get announcements), `idss-reseed.timer` armed (5 min). First live `run` surfaced two wrapper bugs the lib-only suite could not: `b4fef9d` (`pin_override`/`served_sha` tripped `set -e` with no PIN file — the unit exited 1 before logging; plus short-vs-full sha compare) and `8ca4a74` (RETURN trap leaked into `cmd_run`, `tmp: unbound`). The advance itself worked: downloaded, sha256 verified, installed, self-probed — public `x-idss-release: 7a35076d55d7…`. Suite now runs the wrapper offline (26 checks). Publish side: see #606 (token) and #621 (seam red).
Author
Owner

Ben's ruling, 2026-08-25 (interactive session): closed as proven.

Live probe today: HEAD https://get.idss.nz/get?arch=x86_64 → x-idss-release: 129efa325a3756c6307a82a99133fd2b1648a72f — that is 2026-08-25's phase-5 spec commit on main, served with no hands involved: CI published the artifact (#606, unblocked by #621), the droplet's idss-reseed.timer pulled and advanced the pin. The full chain this ticket asked for is standing: ADR 0185 rules the tracking-pin policy, publish is wired in .forgejo, the pull half has been live on the droplet since 2026-08-20, and the pin provably tracks CI-passed main.

Known residue, deliberately not blocking: /etc/idss-reseed.env's Mattermost lines are still commented, so pin advances are logged but not announced. ADR 0185's revisit-before-real-customer-installs clause stands.

**Ben's ruling, 2026-08-25 (interactive session): closed as proven.** Live probe today: `HEAD https://get.idss.nz/get?arch=x86_64` → `x-idss-release: 129efa325a3756c6307a82a99133fd2b1648a72f` — that is 2026-08-25's phase-5 spec commit on `main`, served with **no hands involved**: CI published the artifact (#606, unblocked by #621), the droplet's `idss-reseed.timer` pulled and advanced the pin. The full chain this ticket asked for is standing: ADR 0185 rules the tracking-pin policy, publish is wired in `.forgejo`, the pull half has been live on the droplet since 2026-08-20, and the pin provably tracks CI-passed `main`. Known residue, deliberately not blocking: `/etc/idss-reseed.env`'s Mattermost lines are still commented, so pin advances are logged but not announced. ADR 0185's revisit-before-real-customer-installs clause stands.
ben closed this issue 2026-08-25 20:31:52 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#601
No description provided.