feat(rank6): node-exporter renders from a template; guard chain is one snippet

- service-map render node-exporter-unit --host H: the MIRROR pair comment
  ('keep this file in step') becomes a template. Per-host title, LAN
  address from the hosts map, port from the node-<host> scrape job. Both
  tracked quadlets are now rendered artifacts; check_drift gates them.
- dankclaw/Caddyfile: the nine verbatim Anubis pre-auth chains
  (reverse_proxy anubis:8923 + X-Real-Ip) collapse into the (guarded)
  named snippet; guarded vhosts are 'import guarded'. Validated with real
  caddy 2.11.7 (import resolution clean; the stock image stops at the
  porkbun module and the git basicauth placeholder, as designed).
- vhost-scoped guard greps (authentik, homepage_caddy, marreta_quadlet)
  now pin 'import guarded' in the vhost block.
- Service Inventory + Authentik docs carry the new laws.
This commit is contained in:
Frank
2026-10-13 22:40:50 -07:00
parent 5976ad0550
commit 65bd5ccea7
11 changed files with 206 additions and 78 deletions
@@ -32,6 +32,7 @@ Now there is **one inventory and one reader**:
|`scripts/deploy-remote.sh` (`service_is_allowed`)|same|
|`scripts/test-changed.sh`|`seams [paths...]` — a service's declared `tests` are its seams|
|`dankclaw/pihole/addn-hosts`|`render pihole-hosts` — the tracked file is a rendered artifact|
|`*/observability/quadlet/node-exporter.container`|`render node-exporter-unit --host H` — the MIRROR pair became one template; per-host title, LAN address (hosts map), and port (scrape job) fill it|
|Prometheus scrape jobs, LAN DNS, homepage probes|`check` compares the tracked configs against the inventory's `scrape`/`dns`/`probe` fields (drift gate)|
Selection rules the engine encodes (see `tests/fixtures/service-plan-golden.tsv`,
@@ -64,8 +65,9 @@ the pinned characterization of every tracked path × every target):
- **paths** — every claimed `files`/`dirs`/`retires` glob matches ≥1 tracked file;
- **compose** — the container names in each host's `compose.yaml` have exactly
one quadlet owner (the [[Quadlet Lifecycle]] two-owners trap);
- **drift** — `addn-hosts` equals its render; the Prometheus job set, the DNS
names, and the homepage probe ports equal the inventory's fields.
- **drift** — `addn-hosts` equals its render, each tracked node-exporter unit
equals its per-host render; the Prometheus job set, the DNS names, and the
homepage probe ports equal the inventory's fields.
## 3. Adding, moving, retiring a service
@@ -357,11 +357,15 @@ client → TLS edge → Anubis :8923 → outpost decision → internal
routing matches on hostname, verified 2026-09-02).
`internal_host = http://caddy:8017`, all three flows set, and an
Application attached — the two provisioning rules above.
2. **Route flip in ONE commit/deploy**: the vhost becomes
`reverse_proxy anubis:8923` with `header_up X-Real-Ip {remote_host}`, and
inside the `http://:8017` listener add `@<svc> host <vhost>` +
2. **Route flip in ONE commit/deploy**: the vhost body becomes
`import guarded` — the named snippet at the top of the Caddyfile is the
whole pre-auth chain (`reverse_proxy anubis:8923` + `header_up X-Real-Ip
{remote_host}`; rank 6 retired the nine verbatim copies), and inside the
`http://:8017` listener add `@<svc> host <vhost>` +
`handle @<svc> { reverse_proxy <upstream> }`. Anubis guard set, Caddy TLS
edge, `:8017` routing table, and provider list change together.
`tests/caddyfile.bats` pins that the chain exists exactly once as the
`(guarded)` snippet and every guarded vhost imports it.
3. Deploy via the repo deploy flow (commit first; deploy pushes main itself).
**Verification (all three):**