forge: PostgreSQL probe + failure notices + Grafana alerting for the /dev/shm incident; darling mount-propagation fix #155

Merged
founder merged 1 commit from claude/w6-pg-incident into main 2026-08-19 07:03:11 +00:00
Owner

Companion to #144 (which removed the Darling smoke and moved DSM to sysv). Adds the missing detection: a 2-minute PostgreSQL fresh-backend probe, OnFailure notices on every postgresqlBackup-* unit, Grafana alert rules (new connections failing / backup failed / PG FATAL flood / unit-failure notice) routed to the key.store dispatcher, the alloy syslog_identifier label fix, and the darlingserver mount-propagation source fix (already in the forge store). The doc records the confirmed root cause (mount stacking via shared propagation — nothing was deleted; 43 h at ~9k FATAL/h; four stacked /dev/shm layers, clear at next reboot).

Deploy: needs deploy-forge-host mode=switch; postgres is NOT restarted; grafana/alloy restart. After deploy check journalctl -u grafana | grep -i provision and systemctl status key-store-postgresql-smoke.timer.

Workflow-orchestrated + adversarially reviewed (LAND), re-cut after #144.

🤖 Generated with Claude Code

Companion to #144 (which removed the Darling smoke and moved DSM to sysv). Adds the missing **detection**: a 2-minute PostgreSQL fresh-backend probe, `OnFailure` notices on every `postgresqlBackup-*` unit, Grafana alert rules (new connections failing / backup failed / PG FATAL flood / unit-failure notice) routed to the key.store dispatcher, the alloy syslog_identifier label fix, and the darlingserver mount-propagation source fix (already in the forge store). The doc records the confirmed root cause (mount stacking via shared propagation — nothing was deleted; 43 h at ~9k FATAL/h; four stacked /dev/shm layers, clear at next reboot). Deploy: needs `deploy-forge-host mode=switch`; postgres is NOT restarted; grafana/alloy restart. After deploy check `journalctl -u grafana | grep -i provision` and `systemctl status key-store-postgresql-smoke.timer`. Workflow-orchestrated + adversarially reviewed (LAND), re-cut after #144. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
forge: PostgreSQL probe + failure notices + Grafana alerting for the /dev/shm incident; darling mount-propagation fix
Some checks failed
Namespace: Build Images / Refresh macOS runner lane (push) Successful in 4s
Release: If Needed / Check (Release Needed) (push) Has been cancelled
Deploy: API / Deploy (API) (push) Has been cancelled
Deploy: Web / Deploy (Web) (push) Has been cancelled
Namespace: Build Images / Refresh macOS Nix snapshot application (push) Successful in 39s
Namespace: Build Images / Refresh Linux runner image (push) Successful in 44s
3593851713
Companion to e5a6dd64 / PR #144 (darling host smoke removed, DSM on sysv):
what the incident still lacked was detection. Root cause, for the record:
key-store-darling-smoke ran the setuid Darling launcher in the host mount
namespace; darlingserver unshares CLONE_NEWNS, umounts /dev/shm and mounts
a fresh tmpfs BEFORE making / MS_SLAVE, so on systemd's MS_SHARED root the
EBUSY umount stacked a new empty tmpfs over the host /dev/shm and every new
PostgreSQL backend opened its DSM segment by path -> ENOENT (43 h of
FATALs at ~9k/h; three onsets each within ~1 s of a smoke tick; four
stacked /dev/shm layers on the host). Nothing was deleted.

- keystore-forge.nix: key-store-postgresql-smoke.{service,timer} (fresh
  backend + pg_stat_activity every 2 min; warns while /dev/shm is stacked),
  key-store-failure-notice@ template with OnFailure= on all seven
  postgresqlBackup-* units and the smoke (the backups were red for 5 h
  silently).
- grafana module: stable datasource UIDs, root notification policy ->
  key.store dispatcher (alerting.dispatcher.routeAll), provisioned rule
  groups key-store-forge-health (new connections failing, backup failed)
  and key-store-forge-health-logs (PostgreSQL FATAL flood, unit failure
  notice); alerting.forgeHealth.enable.
- loki module: alloy relabel __journal__syslog_identifier ->
  __journal_syslog_identifier (the label never existed).
- Packages/darling: darlingserver makes / MS_REC|MS_SLAVE right after
  unshare(CLONE_NEWNS), before touching /dev/shm (output already in the
  forge store; no rebuild).
- docs/infrastructure/forge-postgres-dev-shm-incident-2026-08-17.md: RCA,
  evidence, runbook; supersedes the "unknown deleter" narrative.

Verified: nix-instantiate --parse; nix eval of the new units/OnFailure;
grafana alert YAMLs realised + parsed; alloy fmt; full toplevel eval; the
deploy does NOT restart postgresql (unit derivation identical); grafana,
grafana-env, grafana-alloy-journal, suid-sgid-wrappers restart.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
founder deleted branch claude/w6-pg-incident 2026-08-19 07:03:11 +00:00
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
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
key-store/key.store!155
No description provided.