Stand up cache.idss.nz: the Spaces bucket, the rail's access key, the cache.idss.nz-1 signing key in matou-infra, and the sign-and-publish step (ADR 0275) #1801

Closed
opened 2026-09-23 21:02:27 +00:00 by ben · 10 comments
Owner

ADR 0275 (Ben's ruling on #1767, 2026-09-23) decided where Mātou's binary cache lives and who signs it. This ticket makes it exist. #1768 (the installer base substitutes from the cache instead of riding the installer) cannot start until this is live.

Hand steps — Mātou credentials, so these stop on a human (Ben, or me with the DO token and the matou-infra age key)

  1. Bucket. A DigitalOcean Spaces bucket in syd1 (the rented gateways' region), name e.g. idss-cache, public read, CDN off for now (ADR 0275 leaves a CDN as a later two-way change). Record the endpoint (idss-cache.syd1.digitaloceanspaces.com).
  2. Zone. cache.idss.nz CNAME → that endpoint, in the idss.nz zone (ADR 0128, the Cloudflare API the rail already uses).
  3. Signing key. nix key generate-secret --key-name cache.idss.nz-1 > cache-secret; nix key convert-secret-to-public < cache-secret gives the public half. Seal cache-secret as a sops secret in matou-infra readable by the release rail's age recipient only. Commit the public half in this repo (see step 6). Never paste the secret into a ticket, a log or a chat.
  4. Rail access key. A Spaces access key pair scoped to the bucket, sealed in matou-infra next to the signing key; the rail exports it as AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY for nix copy.
  5. Cache header. Put a nix-cache-info object at the bucket root: StoreDir: /nix/store, WantMassQuery: 1, Priority: 40 (lower priority than cache.nixos.org's 30 so the public cache is asked first).

Agent steps — once 1–5 are done and the public key + endpoint are in this repo

  1. Pin the trust. Add https://cache.idss.nz after https://cache.nixos.org in substituters, and cache.idss.nz-1:<pubkey> after cache.nixos.org-1:… in trusted-public-keys, in BOTH the installer-base (kexec) configuration and the gateway's NixOS configuration. Order matters (ADR 0275 consequences).
  2. Publish step. scripts/build-installer-base-warm.sh signs the built installer-base closure with the cache key (nix store sign --key-file … -r <toplevel>) and nix copy --to 's3://idss-cache?region=syd1&endpoint=syd1.digitaloceanspaces.com' <toplevel>. It runs at the release revision only (ADR 0272 §6 — exact revision, never latest) and refuses to run with a dirty tree.
  3. Prove it. From a clean DO droplet in syd1 with only the stock Nix, nix path-info --store https://cache.idss.nz <installer-base toplevel> answers, and nix build --dry-run of .#kexec-installer-base on a store trusting both keys reports 0 derivations to build. Record the numbers on this ticket.
  4. GOTCHAS entry. A path present in the cache but not signed by a trusted key does NOT substitute — the gateway silently falls back to building it, and the 46-minute static-CPython build on a 2-vCPU box is the symptom of a missing/wrong signature, not a missing path.

Not in this ticket

  • Removing installer-base-cache/ from the installer — that is #1768, which this unblocks.
  • Publishing ADR 0133's warm gateway closure — ADR 0272 leaves it to re-measurement.

Relates to: ADR 0275, ADR 0272, ADR 0248, #1767, #1768, #1769, #1770.

ADR 0275 (Ben's ruling on #1767, 2026-09-23) decided where Mātou's binary cache lives and who signs it. This ticket makes it exist. #1768 (the installer base substitutes from the cache instead of riding the installer) cannot start until this is live. ## Hand steps — Mātou credentials, so these stop on a human (Ben, or me with the DO token and the `matou-infra` age key) 1. **Bucket.** A DigitalOcean Spaces bucket in `syd1` (the rented gateways' region), name e.g. `idss-cache`, **public read**, CDN off for now (ADR 0275 leaves a CDN as a later two-way change). Record the endpoint (`idss-cache.syd1.digitaloceanspaces.com`). 2. **Zone.** `cache.idss.nz` CNAME → that endpoint, in the `idss.nz` zone (ADR 0128, the Cloudflare API the rail already uses). 3. **Signing key.** `nix key generate-secret --key-name cache.idss.nz-1 > cache-secret`; `nix key convert-secret-to-public < cache-secret` gives the public half. Seal `cache-secret` as a sops secret in `matou-infra` readable by the release rail's age recipient only. Commit the **public** half in this repo (see step 6). Never paste the secret into a ticket, a log or a chat. 4. **Rail access key.** A Spaces access key pair scoped to the bucket, sealed in `matou-infra` next to the signing key; the rail exports it as `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` for `nix copy`. 5. **Cache header.** Put a `nix-cache-info` object at the bucket root: `StoreDir: /nix/store`, `WantMassQuery: 1`, `Priority: 40` (lower priority than cache.nixos.org's 30 so the public cache is asked first). ## Agent steps — once 1–5 are done and the public key + endpoint are in this repo 6. **Pin the trust.** Add `https://cache.idss.nz` after `https://cache.nixos.org` in `substituters`, and `cache.idss.nz-1:<pubkey>` after `cache.nixos.org-1:…` in `trusted-public-keys`, in BOTH the installer-base (kexec) configuration and the gateway's NixOS configuration. Order matters (ADR 0275 consequences). 7. **Publish step.** `scripts/build-installer-base-warm.sh` signs the built installer-base closure with the cache key (`nix store sign --key-file … -r <toplevel>`) and `nix copy --to 's3://idss-cache?region=syd1&endpoint=syd1.digitaloceanspaces.com' <toplevel>`. It runs at the release revision only (ADR 0272 §6 — exact revision, never latest) and refuses to run with a dirty tree. 8. **Prove it.** From a clean DO droplet in syd1 with only the stock Nix, `nix path-info --store https://cache.idss.nz <installer-base toplevel>` answers, and `nix build --dry-run` of `.#kexec-installer-base` on a store trusting both keys reports **0 derivations to build**. Record the numbers on this ticket. 9. **GOTCHAS entry.** A path present in the cache but not signed by a trusted key does NOT substitute — the gateway silently falls back to building it, and the 46-minute static-CPython build on a 2-vCPU box is the symptom of a missing/wrong signature, not a missing path. ## Not in this ticket - Removing `installer-base-cache/` from the installer — that is #1768, which this unblocks. - Publishing ADR 0133's warm gateway closure — ADR 0272 leaves it to re-measurement. Relates to: ADR 0275, ADR 0272, ADR 0248, #1767, #1768, #1769, #1770.

Blocked — human hand steps (Mātou credentials) not yet done

The agent steps (6–9) are explicitly gated: "once 1–5 are done and the public key + endpoint are in this repo." Neither is true yet:

  • No cache.idss.nz-1 public key is committed anywhere in the repo (grep for cache.idss.nz-1 / idss-cache.syd1 returns nothing), and the only comment on this issue is the swarm-claim — so a human has not posted it.
  • Hand steps 1–5 require Mātou credentials this run does not have: the DigitalOcean token (bucket in syd1, Spaces access key) and the matou-infra age key (to seal the signing secret + access key as sops secrets). The ticket itself states these "stop on a human (Ben, or me with the DO token and the matou-infra age key)."

Why this is a human residue, not an agent two-way-door ruling:

  • Step 3 mints a signing credential (cache.idss.nz-1) and seals it in matou-infra — a credential creation.
  • Step 6 adds cache.idss.nz-1:<pubkey> to trusted-public-keys — a security-posture widening (trusting a new signer). It cannot even be written without the real public-key value that only step 3 produces; a placeholder would be a wrong/absent signature, which per step 9 silently drops the gateway into the 46-minute static-CPython rebuild.
  • Step 1 provisions a paid DO Spaces bucket — non-routine spend.

These are on the one-way-door list, and none of steps 6–8 are provable by a test I can run until the bucket, keys and public key exist.

Why human

A human with the DO token + matou-infra age key (Ben, or an interactive session with those) must complete hand steps 1–5 — create the syd1 idss-cache bucket (public read), the cache.idss.nz CNAME, generate cache.idss.nz-1 and seal the secret + a scoped Spaces access key in matou-infra, and drop the nix-cache-info object — then commit the cache.idss.nz-1 public half + the confirmed bucket endpoint into this repo (or post them here). Once that lands, re-add ready-for-agent; the next agent iteration can then do steps 6–9 (pin the trust in the installer-base + gateway configs, add the sign-and-publish step to scripts/build-installer-base-warm.sh, prove substitution from a clean syd1 droplet, add the GOTCHAS entry).

Note: ADR 0275 is referenced but is not yet committed in docs/adr/ — worth landing alongside the public key.

## Blocked — human hand steps (Mātou credentials) not yet done The agent steps (6–9) are explicitly gated: *"once 1–5 are done and the public key + endpoint are in this repo."* Neither is true yet: - No `cache.idss.nz-1` public key is committed anywhere in the repo (`grep` for `cache.idss.nz-1` / `idss-cache.syd1` returns nothing), and the only comment on this issue is the swarm-claim — so a human has not posted it. - Hand steps 1–5 require **Mātou credentials this run does not have**: the DigitalOcean token (bucket in `syd1`, Spaces access key) and the `matou-infra` age key (to seal the signing secret + access key as sops secrets). The ticket itself states these *"stop on a human (Ben, or me with the DO token and the `matou-infra` age key)."* Why this is a human residue, not an agent two-way-door ruling: - **Step 3** mints a signing **credential** (`cache.idss.nz-1`) and seals it in `matou-infra` — a credential creation. - **Step 6** adds `cache.idss.nz-1:<pubkey>` to `trusted-public-keys` — a **security-posture widening** (trusting a new signer). It cannot even be written without the *real* public-key value that only step 3 produces; a placeholder would be a wrong/absent signature, which per step 9 silently drops the gateway into the 46-minute static-CPython rebuild. - **Step 1** provisions a paid DO Spaces bucket — **non-routine spend**. These are on the one-way-door list, and none of steps 6–8 are provable by a test I can run until the bucket, keys and public key exist. ## Why human A human with the DO token + `matou-infra` age key (Ben, or an interactive session with those) must complete hand steps 1–5 — create the `syd1` `idss-cache` bucket (public read), the `cache.idss.nz` CNAME, generate `cache.idss.nz-1` and seal the secret + a scoped Spaces access key in `matou-infra`, and drop the `nix-cache-info` object — then **commit the `cache.idss.nz-1` public half + the confirmed bucket endpoint into this repo** (or post them here). Once that lands, re-add `ready-for-agent`; the next agent iteration can then do steps 6–9 (pin the trust in the installer-base + gateway configs, add the sign-and-publish step to `scripts/build-installer-base-warm.sh`, prove substitution from a clean syd1 droplet, add the GOTCHAS entry). Note: ADR 0275 is referenced but is not yet committed in `docs/adr/` — worth landing alongside the public key.
Author
Owner

Three corrections to the hand steps (2026-09-24, checked before the walk-through)

  1. Step 5 priority. https://cache.nixos.org/nix-cache-info says Priority: 40, not 30. Lower number wins, so ours must be 50. Easiest: let the first nix copy write the header by passing priority=50 in the store URL (s3://idss-cache?region=syd1&endpoint=syd1.digitaloceanspaces.com&priority=50) — Nix writes nix-cache-info itself when the bucket has none.

  2. Step 1/2 TLS. A bare CNAME cache.idss.nz → idss-cache.syd1.digitaloceanspaces.com serves Spaces' own certificate (*.syd1.digitaloceanspaces.com), so https://cache.idss.nz fails TLS and Nix will not substitute. The DO-supported way to put a custom hostname on a bucket is the Spaces CDN with a custom subdomain (DO issues the Let's Encrypt cert; the CNAME then targets the CDN endpoint). So "CDN off" is withdrawn: enable it, add cache.idss.nz as the custom subdomain, and make the Cloudflare record DNS-only (grey cloud) so DO's validation and TLS reach DO. ADR 0275's decision is unchanged (Spaces, CNAME indirection); this is the mechanism the CNAME needs.

  3. Where the secrets live. ADR 0275 says "sealed in matou-infra" — there is no such repo on git.matou.nz (Matou/matou-infrastructure is KERI/any-sync, no sops layout). The rail (release-publish.yml, runner elitebook-03) already reads its testing feed key as the Forgejo Actions secret RELEASE_TESTING_SEED. The cache key and the Spaces key pair go in the same place: repo secrets on Matou/idss — CACHE_SIGNING_KEY (the nix key generate-secret output), CACHE_S3_ACCESS_KEY_ID, CACHE_S3_SECRET_ACCESS_KEY. Same custody set as the testing key (ADR 0248 amendment). ADR 0275 gets a one-line amendment when the publish step lands.

Also checked: doctl on Ben's laptop is authenticated as the account owner, doctl spaces keys list is empty (no key exists yet), and the laptop's Nix (Determinate 3.22.5) speaks s3://…?endpoint= with the DO endpoint, so step 8's proof can run from here as well as from a syd1 droplet.

## Three corrections to the hand steps (2026-09-24, checked before the walk-through) 1. **Step 5 priority.** `https://cache.nixos.org/nix-cache-info` says `Priority: 40`, not 30. Lower number wins, so ours must be **50**. Easiest: let the first `nix copy` write the header by passing `priority=50` in the store URL (`s3://idss-cache?region=syd1&endpoint=syd1.digitaloceanspaces.com&priority=50`) — Nix writes `nix-cache-info` itself when the bucket has none. 2. **Step 1/2 TLS.** A bare CNAME `cache.idss.nz → idss-cache.syd1.digitaloceanspaces.com` serves Spaces' own certificate (`*.syd1.digitaloceanspaces.com`), so `https://cache.idss.nz` fails TLS and Nix will not substitute. The DO-supported way to put a custom hostname on a bucket is the Spaces **CDN with a custom subdomain** (DO issues the Let's Encrypt cert; the CNAME then targets the CDN endpoint). So "CDN off" is withdrawn: enable it, add `cache.idss.nz` as the custom subdomain, and make the Cloudflare record **DNS-only** (grey cloud) so DO's validation and TLS reach DO. ADR 0275's decision is unchanged (Spaces, CNAME indirection); this is the mechanism the CNAME needs. 3. **Where the secrets live.** ADR 0275 says "sealed in `matou-infra`" — there is no such repo on git.matou.nz (`Matou/matou-infrastructure` is KERI/any-sync, no sops layout). The rail (`release-publish.yml`, runner `elitebook-03`) already reads its `testing` feed key as the Forgejo Actions secret `RELEASE_TESTING_SEED`. The cache key and the Spaces key pair go in **the same place**: repo secrets on `Matou/idss` — `CACHE_SIGNING_KEY` (the `nix key generate-secret` output), `CACHE_S3_ACCESS_KEY_ID`, `CACHE_S3_SECRET_ACCESS_KEY`. Same custody set as the testing key (ADR 0248 amendment). ADR 0275 gets a one-line amendment when the publish step lands. Also checked: `doctl` on Ben's laptop is authenticated as the account owner, `doctl spaces keys list` is empty (no key exists yet), and the laptop's Nix (Determinate 3.22.5) speaks `s3://…?endpoint=` with the DO endpoint, so step 8's proof can run from here as well as from a syd1 droplet.
Author
Owner

Progress 2026-09-24 — DO path chosen; what is done and what is verified

  • Spaces key idss-cache-rail (fullaccess) exists on the account (Ben, 13:35Z). Full access is what PutBucketPolicy needs (DO docs: limited-access keys cannot set a policy); the rail can move to a bucket-scoped readwrite key after the policy is set.
  • Objects in a Space are private by default; the bucket policy {"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::idss-cache/*"} makes every object public (DO docs, supported on standard Spaces). This is step 5's missing half.
  • Bootstrap script written: ~/idss-app/cache/bootstrap-bucket.sh on Ben's laptop — creates the bucket in syd1, sets that policy, writes nix-cache-info with Priority: 50, and proves an anonymous GET of it. Runs with the key exported in the shell; prints nothing secret.
  • TLS for cache.idss.nz (corrects yesterday's step 1/2 again): DO issues a Let's Encrypt cert for a CDN custom subdomain only if the name is in DigitalOcean DNS; otherwise you upload your own cert and renew it by hand. With idss.nz on Cloudflare (ADR 0128) the clean route is to delegate just cache.idss.nz to DO: add cache.idss.nz as a domain in DO Networking, and in Cloudflare add NS records for cache → ns1/ns2/ns3.digitalocean.com (DNS-only). DO then owns the CNAME and the cert. ADR 0275's indirection holds (the name still moves with us), one NS record replaces the CNAME in the Cloudflare zone; reservedSlugs still gains cache.
  • Local Nix (Determinate 3.22.5) speaks s3://…?endpoint=syd1.digitaloceanspaces.com&scheme=https and has the priority store setting; awscli2 obtainable via nix shell.
## Progress 2026-09-24 — DO path chosen; what is done and what is verified - Spaces key `idss-cache-rail` (fullaccess) exists on the account (Ben, 13:35Z). Full access is what `PutBucketPolicy` needs (DO docs: limited-access keys cannot set a policy); the rail can move to a bucket-scoped `readwrite` key after the policy is set. - Objects in a Space are **private by default**; the bucket policy `{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::idss-cache/*"}` makes every object public (DO docs, supported on standard Spaces). This is step 5's missing half. - Bootstrap script written: `~/idss-app/cache/bootstrap-bucket.sh` on Ben's laptop — creates the bucket in syd1, sets that policy, writes `nix-cache-info` with `Priority: 50`, and proves an anonymous GET of it. Runs with the key exported in the shell; prints nothing secret. - **TLS for `cache.idss.nz` (corrects yesterday's step 1/2 again):** DO issues a Let's Encrypt cert for a CDN custom subdomain **only if the name is in DigitalOcean DNS**; otherwise you upload your own cert and renew it by hand. With `idss.nz` on Cloudflare (ADR 0128) the clean route is to **delegate just `cache.idss.nz`** to DO: add `cache.idss.nz` as a domain in DO Networking, and in Cloudflare add NS records for `cache` → `ns1/ns2/ns3.digitalocean.com` (DNS-only). DO then owns the CNAME and the cert. ADR 0275's indirection holds (the name still moves with us), one NS record replaces the CNAME in the Cloudflare zone; `reservedSlugs` still gains `cache`. - Local Nix (Determinate 3.22.5) speaks `s3://…?endpoint=syd1.digitaloceanspaces.com&scheme=https` and has the `priority` store setting; awscli2 obtainable via `nix shell`.
Author
Owner

Step 1, 2 and 5 DONE 2026-09-24 (Ben ran bootstrap-bucket.sh)

  • Bucket idss-cache created in syd1; endpoint https://idss-cache.syd1.digitaloceanspaces.com.
  • Bucket policy: anonymous s3:GetObject on idss-cache/* — set.
  • nix-cache-info written: StoreDir: /nix/store, WantMassQuery: 1, Priority: 50. Anonymous curl → HTTP 200.
  • nix store info --store https://idss-cache.syd1.digitaloceanspaces.com on a stock Determinate Nix answers — the bucket is a readable binary cache as-is (empty).
  • Spaces key idss-cache-rail (fullaccess) is the rail's write key; goes into Forgejo secrets at step 5b.

Remaining hand steps: DNS delegation of cache.idss.nz to DO + CDN custom subdomain (cert), nix key generate-secret for cache.idss.nz-1, the three Matou/idss Actions secrets. Then agent steps 6–9.

## Step 1, 2 and 5 DONE 2026-09-24 (Ben ran `bootstrap-bucket.sh`) - Bucket `idss-cache` created in **syd1**; endpoint `https://idss-cache.syd1.digitaloceanspaces.com`. - Bucket policy: anonymous `s3:GetObject` on `idss-cache/*` — set. - `nix-cache-info` written: `StoreDir: /nix/store`, `WantMassQuery: 1`, `Priority: 50`. Anonymous `curl` → HTTP 200. - `nix store info --store https://idss-cache.syd1.digitaloceanspaces.com` on a stock Determinate Nix answers — the bucket is a readable binary cache as-is (empty). - Spaces key `idss-cache-rail` (fullaccess) is the rail's write key; goes into Forgejo secrets at step 5b. Remaining hand steps: DNS delegation of `cache.idss.nz` to DO + CDN custom subdomain (cert), `nix key generate-secret` for `cache.idss.nz-1`, the three `Matou/idss` Actions secrets. Then agent steps 6–9.
Author
Owner

Agent steps 6, 7, 9 LANDED on main 7018fb3f (2026-09-24)

  • Trust pinned (6): nix/matou-cache.nix — extra-substituters = [ https://cache.idss.nz ], extra-trusted-public-keys = [ cache.idss.nz-1:jryaAm0uulUbamaQ5/9Shb9SkpMW3rVv49FkzRNOf7E= ] — imported by the kexec installer base (flake.nix kexecInstallerBaseConfig), the rented gateway image and the VM guest image; internal/clan/matoucache.go pins the same into renderGatewayGuest for standing nodes. TestMatouCache_PinnedEverywhere holds all four to one value and to extra-* only. Proven by building each image's nix.conf: substituters = https://cache.nixos.org/ then extra-substituters = https://cache.idss.nz (the kexec base also lists / after ours — nixos-images' own entry, harmless).
  • Publish step (7): scripts/release-rail/publish-cache.sh + scripts/tests/cache-publish-test.sh (9 checks green) + .forgejo/workflows/cache-publish.yml on matou-workstation (syd1, beside the bucket — elitebook-03's home line would outrun any timeout). Signs on the way out (secret-key= on the s3 URL), refuses a dirty tree, short-circuits on an already-signed marker, verifies every path + the marker's signature through the read URL. build-installer-base-warm.sh now writes installer-base.paths.
  • GOTCHAS #331 (9): in-cache-but-unsigned silently rebuilds.
  • ADR 0275 amendment (secret home = Forgejo Actions secrets; TLS via NS delegation of cache.idss.nz to DO DNS; priority 50). Architecture view 11 updated. Broker reservedSlugs gains cache.

First publish dispatched with read_url=https://idss-cache.syd1.digitaloceanspaces.com (the CNAME has no cert yet). Step 8's proof follows on this ticket once it lands.

Still on Ben: delegate cache.idss.nz — add it as a domain in DO Networking, NS records for cache → ns1/ns2/ns3.digitalocean.com in the Cloudflare zone (DNS-only), then the bucket's CDN custom subdomain with a Let's Encrypt cert. Until then gateways built from 7018fb3f list a substituter that fails TLS — Nix warns and falls back, not fatal, but the cache does nothing for them.

## Agent steps 6, 7, 9 LANDED on main `7018fb3f` (2026-09-24) - **Trust pinned (6):** `nix/matou-cache.nix` — `extra-substituters = [ https://cache.idss.nz ]`, `extra-trusted-public-keys = [ cache.idss.nz-1:jryaAm0uulUbamaQ5/9Shb9SkpMW3rVv49FkzRNOf7E= ]` — imported by the kexec installer base (`flake.nix` kexecInstallerBaseConfig), the rented gateway image and the VM guest image; `internal/clan/matoucache.go` pins the same into `renderGatewayGuest` for standing nodes. `TestMatouCache_PinnedEverywhere` holds all four to one value and to `extra-*` only. **Proven** by building each image's `nix.conf`: `substituters = https://cache.nixos.org/` then `extra-substituters = https://cache.idss.nz` (the kexec base also lists `/` after ours — nixos-images' own entry, harmless). - **Publish step (7):** `scripts/release-rail/publish-cache.sh` + `scripts/tests/cache-publish-test.sh` (9 checks green) + `.forgejo/workflows/cache-publish.yml` on **`matou-workstation`** (syd1, beside the bucket — elitebook-03's home line would outrun any timeout). Signs on the way out (`secret-key=` on the s3 URL), refuses a dirty tree, short-circuits on an already-signed marker, verifies every path + the marker's signature through the read URL. `build-installer-base-warm.sh` now writes `installer-base.paths`. - **GOTCHAS #331 (9):** in-cache-but-unsigned silently rebuilds. - ADR 0275 amendment (secret home = Forgejo Actions secrets; TLS via NS delegation of `cache.idss.nz` to DO DNS; priority 50). Architecture view 11 updated. Broker `reservedSlugs` gains `cache`. **First publish dispatched** with `read_url=https://idss-cache.syd1.digitaloceanspaces.com` (the CNAME has no cert yet). Step 8's proof follows on this ticket once it lands. **Still on Ben:** delegate `cache.idss.nz` — add it as a domain in DO Networking, NS records for `cache` → ns1/ns2/ns3.digitalocean.com in the Cloudflare zone (DNS-only), then the bucket's CDN custom subdomain with a Let's Encrypt cert. Until then gateways built from `7018fb3f` list a substituter that fails TLS — Nix warns and falls back, not fatal, but the cache does nothing for them.
Author
Owner

Step 8 PROVEN 2026-09-24 — the cache serves the installer base

First cache-publish run (Forgejo run 31841, matou-workstation, 31 min): nix copy landed all 1,359 paths signed by cache.idss.nz-1. Proof from the laptop on a fresh chroot store:

nix build --dry-run .#kexec-installer-base derivations to build paths fetched
cache.nixos.org only 67 777 (713 MiB)
+ https://idss-cache.syd1.digitaloceanspaces.com trusting cache.idss.nz-1 3 693 (555 MiB)

The 3 are squashfs.img, initrd, kexec-tarball — exactly the assembled artifacts the narrowing drops on purpose (#1048; the compose rebuilds them anyway). The laptop's evaluated toplevel equals the published marker /nix/store/6rwrc1w5…-nixos-system-nixos-installer-kexec-26.05pre-git; 40/40 sampled narinfos carry Sig: cache.idss.nz-1:.

Why the run itself went red, and the fix (GOTCHAS #332, landed on main): the verify read the marker 5 s after its PUT and got 403 — Spaces is eventually consistent on the anonymous read side (403, not 404: GetObject without ListBucket), and it stayed 403 for ~20 min. Worse, a Nix client that probes in that window pins "absent" for an hour (narinfo-cache-negative-ttl 3600 s), which is why the first laptop proof read nothing while curl read everything. publish-cache.sh step 4 is now a wait with a 30-min ceiling and every read probe bypasses the negative cache; the test fakes the lag.

Read the job log via Forgejo's web route /Matou/idss/actions/runs/31841/jobs/0/attempt/1/logs (repo is public) — the runs API 504s.

Left: Ben's NS delegation of cache.idss.nz (DO Networking domain + Cloudflare NS records + the bucket's CDN custom subdomain with a Let's Encrypt cert); until then the workflow verifies through the raw endpoint. #1768 is unblocked.

## Step 8 PROVEN 2026-09-24 — the cache serves the installer base First `cache-publish` run (Forgejo run 31841, matou-workstation, 31 min): `nix copy` landed all **1,359** paths signed by `cache.idss.nz-1`. Proof from the laptop on a **fresh chroot store**: | `nix build --dry-run .#kexec-installer-base` | derivations to build | paths fetched | |---|---|---| | cache.nixos.org only | **67** | 777 (713 MiB) | | + `https://idss-cache.syd1.digitaloceanspaces.com` trusting `cache.idss.nz-1` | **3** | 693 (555 MiB) | The 3 are `squashfs.img`, `initrd`, `kexec-tarball` — exactly the assembled artifacts the narrowing drops on purpose (#1048; the compose rebuilds them anyway). The laptop's evaluated toplevel equals the published marker `/nix/store/6rwrc1w5…-nixos-system-nixos-installer-kexec-26.05pre-git`; 40/40 sampled narinfos carry `Sig: cache.idss.nz-1:`. **Why the run itself went red, and the fix (`GOTCHAS #332`, landed on main):** the verify read the marker 5 s after its PUT and got **403** — Spaces is eventually consistent on the anonymous read side (403, not 404: GetObject without ListBucket), and it stayed 403 for ~20 min. Worse, a Nix client that probes in that window pins "absent" for an hour (`narinfo-cache-negative-ttl` 3600 s), which is why the first laptop proof read nothing while `curl` read everything. `publish-cache.sh` step 4 is now a wait with a 30-min ceiling and every read probe bypasses the negative cache; the test fakes the lag. Read the job log via Forgejo's web route `/Matou/idss/actions/runs/31841/jobs/0/attempt/1/logs` (repo is public) — the runs API 504s. **Left:** Ben's NS delegation of `cache.idss.nz` (DO Networking domain + Cloudflare NS records + the bucket's CDN custom subdomain with a Let's Encrypt cert); until then the workflow verifies through the raw endpoint. **#1768 is unblocked.**
Author
Owner

Second run GREEN — idempotence proven (run 31883, ae34f60c, 2026-09-24 15:19Z)

[publish-cache] already published: this revision's installer base (/nix/store/6rwrc1w5…-nixos-system-nixos-installer-kexec-26.05pre-git) is in the cache and signed by cache.idss.nz-1 — nothing to build or copy — 13 seconds from checkout to success (one flake eval + one signed narinfo read, landed in ae34f60c). The 6-hourly schedule now costs seconds while the installer base is unchanged and ~35 minutes only when a nixos-images bump changes it.

Steps 1–9 are all done except the name: the NS delegation of cache.idss.nz is the one hand step left (DO Networking domain cache.idss.nz → Cloudflare NS records for cache → the bucket's CDN custom subdomain + Let's Encrypt). Until it is in, gateways built from main list a substituter that fails TLS (Nix warns, falls back to cache.nixos.org and the packed copy — not fatal), and the workflow verifies through the raw endpoint. Once the cert answers, dispatch once with no read_url and the default verify runs through https://cache.idss.nz.

Leaving ready-for-human on for that step. #1768 can start now against the raw endpoint's proof.

## Second run GREEN — idempotence proven (run 31883, `ae34f60c`, 2026-09-24 15:19Z) `[publish-cache] already published: this revision's installer base (/nix/store/6rwrc1w5…-nixos-system-nixos-installer-kexec-26.05pre-git) is in the cache and signed by cache.idss.nz-1 — nothing to build or copy` — **13 seconds** from checkout to success (one flake eval + one signed narinfo read, landed in `ae34f60c`). The 6-hourly schedule now costs seconds while the installer base is unchanged and ~35 minutes only when a nixos-images bump changes it. Steps 1–9 are all done except the name: **the NS delegation of `cache.idss.nz` is the one hand step left** (DO Networking domain `cache.idss.nz` → Cloudflare NS records for `cache` → the bucket's CDN custom subdomain + Let's Encrypt). Until it is in, gateways built from main list a substituter that fails TLS (Nix warns, falls back to cache.nixos.org and the packed copy — not fatal), and the workflow verifies through the raw endpoint. Once the cert answers, dispatch once with no `read_url` and the default verify runs through `https://cache.idss.nz`. Leaving `ready-for-human` on for that step. #1768 can start now against the raw endpoint's proof.
Author
Owner

The name, 2026-09-24 16:00–16:20Z — delegated, certificate issued, CDN bound; hostname still provisioning

  • Cloudflare: three NS records cache → ns1/ns2/ns3.digitalocean.com written with the broker's own zone token from the mail droplet (Ben, via sudo reading /etc/ourcloud/broker.env — the idss-broker token of ADR 0128). dig NS cache.idss.nz answers DO's nameservers from 1.1.1.1 and 8.8.8.8.
  • DigitalOcean DNS: domain cache.idss.nz created (doctl). DO wrote its _acme-challenge TXT there and the Let's Encrypt certificate cache-idss-nz (e0ea1357-…) went pending → verified in ~30 s; CN=cache.idss.nz, valid to 2026-12-23, DO renews it through this zone — the delegation must stay.
  • CDN endpoint 1ecedf3f-…: origin idss-cache.syd1.digitaloceanspaces.com, endpoint idss-cache.syd1.cdn.digitaloceanspaces.com, custom domain cache.idss.nz, that certificate. The endpoint hostname serves nix-cache-info (HTTP 200) already.
  • The apex: DO refused a CNAME at the delegated zone's apex (CNAME records cannot share a name with other records) and wrote nothing when the custom domain was bound. DO's CDN is fronted by Cloudflare (the endpoint resolves to 104.18.42.227 / 172.64.145.29 + two 2606:4700 AAAA), so the apex carries A/AAAA records pinned to those four edge addresses (TTL 300). Public resolvers now return them for cache.idss.nz. Hazard: if DO's edge addresses ever change, the pin rots — the cache-publish verify through https://cache.idss.nz every 6 h is the alarm, and the fix is four records in the DO zone.
  • Current state: TLS on the bare name works (ssl_verify 0, cert CN=cache.idss.nz) but the edge answers HTTP 530 / Cloudflare error 1016 for cache.idss.nz while the CDN's own hostname answers 200 — DO's custom-hostname provisioning on its edge is still catching up (bound at 16:07Z). Re-testing.
## The name, 2026-09-24 16:00–16:20Z — delegated, certificate issued, CDN bound; hostname still provisioning - **Cloudflare:** three NS records `cache → ns1/ns2/ns3.digitalocean.com` written with the broker's own zone token from the mail droplet (Ben, via `sudo` reading `/etc/ourcloud/broker.env` — the `idss-broker` token of ADR 0128). `dig NS cache.idss.nz` answers DO's nameservers from 1.1.1.1 and 8.8.8.8. - **DigitalOcean DNS:** domain `cache.idss.nz` created (doctl). DO wrote its `_acme-challenge` TXT there and the Let's Encrypt certificate `cache-idss-nz` (`e0ea1357-…`) went **pending → verified in ~30 s**; CN=cache.idss.nz, valid to 2026-12-23, DO renews it through this zone — **the delegation must stay**. - **CDN endpoint** `1ecedf3f-…`: origin `idss-cache.syd1.digitaloceanspaces.com`, endpoint `idss-cache.syd1.cdn.digitaloceanspaces.com`, custom domain `cache.idss.nz`, that certificate. The endpoint hostname serves `nix-cache-info` (HTTP 200) already. - **The apex:** DO refused a CNAME at the delegated zone's apex (`CNAME records cannot share a name with other records`) and wrote nothing when the custom domain was bound. DO's CDN is fronted by **Cloudflare** (the endpoint resolves to 104.18.42.227 / 172.64.145.29 + two 2606:4700 AAAA), so the apex carries **A/AAAA records pinned to those four edge addresses** (TTL 300). Public resolvers now return them for `cache.idss.nz`. Hazard: if DO's edge addresses ever change, the pin rots — the `cache-publish` verify through `https://cache.idss.nz` every 6 h is the alarm, and the fix is four records in the DO zone. - **Current state:** TLS on the bare name works (`ssl_verify 0`, cert CN=cache.idss.nz) but the edge answers **HTTP 530 / Cloudflare error 1016** for `cache.idss.nz` while the CDN's own hostname answers 200 — DO's custom-hostname provisioning on its edge is still catching up (bound at 16:07Z). Re-testing.
Author
Owner

The name is LIVE: https://nix.cache.idss.nz (2026-09-24, main b5488eea)

  • Apex proven unservable. With the apex certificate bound, the custom domain set to cache.idss.nz, and the four Cloudflare edge addresses pinned as apex A/AAAA, the edge answered 1016 for 20+ minutes; DO's CDN routes a custom hostname only as a CNAME, and a delegated zone's apex cannot be one. Ben chose option 1.
  • Sub-label: nix CNAME → idss-cache.syd1.cdn.digitaloceanspaces.com in the DO zone, DO certificate nix-cache-idss-nz (e03ddf17-…, CN=nix.cache.idss.nz, to 2026-12-23, renewed by DO through the delegation — keep the NS records), CDN endpoint 1ecedf3f-… custom domain updated. HTTP 200 with our cache.idss.nz-1 signature within 15 s; nix path-info --store https://nix.cache.idss.nz reads the signed marker. Apex pin + apex certificate removed.
  • Renamed on main (b5488eea): nix/matou-cache.nix, internal/clan/matoucache.go (key name unchanged — a key name is a label), publish-cache.sh default read URL, its test, the workflow, GOTCHAS #331/#332, architecture view 11, ADR 0275 amendment 2 rewritten as proven, STATUS.md. Built guest nix.conf: extra-substituters = https://nix.cache.idss.nz.
  • Run 31935 (dispatched with the default read URL) is re-publishing: the module change moved the installer base's toplevel, so this is a full build + copy (~35 min); most paths are already in the bucket and are skipped. Its verify runs through the real name for the first time.

All nine steps of this ticket are done once 31935 lands green. #1768 next.

## The name is LIVE: `https://nix.cache.idss.nz` (2026-09-24, main `b5488eea`) - **Apex proven unservable.** With the apex certificate bound, the custom domain set to `cache.idss.nz`, and the four Cloudflare edge addresses pinned as apex A/AAAA, the edge answered **1016 for 20+ minutes**; DO's CDN routes a custom hostname only as a **CNAME**, and a delegated zone's apex cannot be one. Ben chose option 1. - **Sub-label:** `nix` CNAME → `idss-cache.syd1.cdn.digitaloceanspaces.com` in the DO zone, DO certificate `nix-cache-idss-nz` (`e03ddf17-…`, CN=nix.cache.idss.nz, to 2026-12-23, renewed by DO through the delegation — **keep the NS records**), CDN endpoint `1ecedf3f-…` custom domain updated. **HTTP 200 with our `cache.idss.nz-1` signature within 15 s**; `nix path-info --store https://nix.cache.idss.nz` reads the signed marker. Apex pin + apex certificate removed. - **Renamed on main (`b5488eea`):** `nix/matou-cache.nix`, `internal/clan/matoucache.go` (key name unchanged — a key name is a label), `publish-cache.sh` default read URL, its test, the workflow, GOTCHAS #331/#332, architecture view 11, ADR 0275 amendment 2 rewritten as proven, STATUS.md. Built guest `nix.conf`: `extra-substituters = https://nix.cache.idss.nz`. - **Run 31935** (dispatched with the default read URL) is re-publishing: the module change moved the installer base's toplevel, so this is a full build + copy (~35 min); most paths are already in the bucket and are skipped. Its verify runs through the real name for the first time. All nine steps of this ticket are done once 31935 lands green. #1768 next.
Author
Owner

CLOSED — run 31935 GREEN through the real name (2026-09-24 16:46Z)

[publish-cache] verifying through https://nix.cache.idss.nz → published: 1359 paths at b5488eea, marker /nix/store/6xzkyvq8…-nixos-system-nixos-installer-kexec-26.05pre-git signed by cache.idss.nz-1 in 23 s (the module change moved the toplevel; only the changed leaves were uploaded, the rest were already in the bucket).

Steps 1–9 done: bucket + policy + header (1, 2, 5), the name via delegation + DO certificate + CDN (3), the cache.idss.nz-1 key (4), the three Forgejo secrets (5b), trust pinned in every image and the rendered baseline (6), the sign-and-publish rail (7), the proof — 3 derivations to build against 67 on a cold store (8), GOTCHAS #331/#332 (9). ADR 0275 amended as built. #1768 is unblocked.

## CLOSED — run 31935 GREEN through the real name (2026-09-24 16:46Z) `[publish-cache] verifying through https://nix.cache.idss.nz` → `published: 1359 paths at b5488eea, marker /nix/store/6xzkyvq8…-nixos-system-nixos-installer-kexec-26.05pre-git signed by cache.idss.nz-1` in 23 s (the module change moved the toplevel; only the changed leaves were uploaded, the rest were already in the bucket). Steps 1–9 done: bucket + policy + header (1, 2, 5), the name via delegation + DO certificate + CDN (3), the `cache.idss.nz-1` key (4), the three Forgejo secrets (5b), trust pinned in every image and the rendered baseline (6), the sign-and-publish rail (7), the proof — 3 derivations to build against 67 on a cold store (8), GOTCHAS #331/#332 (9). ADR 0275 amended as built. #1768 is unblocked.
ben closed this issue 2026-09-24 16:47:26 +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#1801
No description provided.