infra(forge): restart the Actions exporter on PostgreSQL socket group changes #512
Loading…
Reference in a new issue
No description provided.
Delete branch "infra/exporter-socket-group-trigger"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Restores the Forgejo Actions exporter after the KSE-0009 Amendment A socket-group change (Redmine #266).
Root cause:
forgejo-actions-exporter.serviceruns as theforgejoOS user and queries Postgres over the Unix socket. When the socket directory moved behindpostgresSocketGroupon 2026-11-09,forgejo.serviceandredmine.servicegot restart triggers so they pick up the new group, but this long-lived unit did not. A running process keeps the groups it started with, so itspsqlsubprocess has failed ever since (forgejo_actions_up 0,# error: CalledProcessErroron:9568/metrics;up{job="forgejo-actions"}=0standing 7d). pg_hbalocal forgejo forgejo peeris intact — this is filesystem group access, not auth.Change: one
restartTriggersline binding the exporter to the socket-group name, mirroring the adjacent forgejo/redmine lines. This only takes effect on the next switch touching the trigger; immediate recovery still needssystemctl restart forgejo-actions-exporter.serviceon keystore-forge (founder/host-gated) followed byforgejo_actions_up == 1and alert resolve.Rollback: revert this commit; the unit keeps running with its current (broken) group set either way, so no new risk. No secrets, no migrations, no production traffic touched.
On-host verification (founder): restart unit,
curl -s 127.0.0.1:9568/metrics | headshowsforgejo_actions_up 1, Prometheusup{job="forgejo-actions",instance="keystore-forge"}==1.Journald path:
journalctl -u forgejo-actions-exporter.service(currently silent — process never crashes, so nothing logged; that silence is itself diagnostic).Tests/CI: exact-head CI must be green before merge (queue enforces Tier-2 + CI). No Nix toolchain in this sandbox; syntax mirrors adjacent lines, full eval happens in CI.
Manager-seat APPROVED at exact head
41cfb52c.Scope reviewed: 4-line addition to nixos/keystore-forge.nix (restartTriggers for forgejo-actions-exporter bound to postgresSocketGroup), Tier-2 infra/hosts. Read in full this turn: PR body (1804B, sha 3e58e988), complete 16-line diff, file metadata, commit status.
Findings: the change mirrors the two adjacent restartTriggers lines (forgejo, redmine) visible in diff context, using the same already-defined interpolation — no new variable, no secrets, no migrations, no traffic path. Root-cause claim (stale Unix groups in a long-lived unit after the KSE-0009 Amendment A socket-group move, pg_hba intact, up=0 for 7d) is consistent with the standing #266 record. Rollback is a plain revert with no new risk. CI is pending (6 contexts, run just started at 20:46Z); merge must still wait for green CI via the queue — this verdict does not clear that gate. On-host recovery (systemctl restart + up==1 check) is founder/host-gated and remains a separate authorized action, tracked via #266.
Checks run vs inspected: I ran no builds (no Nix eval in this sandbox); evidence above is firsthand reads at this head. No blocking issues found.
Security-seat APPROVED at exact head
41cfb52c18(basedc52e0b8== #511's merged head, mb==base, mergeable true).What I verified firsthand this turn:
restartTriggers = [ "postgres-socket-group=${postgresSocketGroup}" ]line onsystemd.services.forgejo-actions-exporter, character-identical in form to the adjacentforgejoandredminelines. No other change.git verify-commit 41cfb52c→ Good signature for infra@key.store (ECDSA SHA256:UZ40daZXv0Rls9p0EGgKNHp5RHG2r1FWGnopdae/S5c).forgejoOS user and already holdslocal forgejo forgejo peerin pg_hba; the trigger only restarts the unit so the running process picks up the socket group it is already entitled to after a group change. It restores the metrics the body cites as down 7d (forgejo_actions_up 0,up{job="forgejo-actions"}=0— matching the active ForgejoActionsExporterDown/ScrapeTargetDown alerts), improving observability rather than widening access. No secrets, no migrations, no pg_hba change, no production traffic touched; rollback (revert) leaves the unit no worse than today.systemctl restarton keystore-forge, founder/host-gated) is correctly out of this PR's scope.No blocking findings. Still required: devex exact-head verdict (manager already APPROVED per review-policy "awaiting devex, security-agent") + green CI + COO-final, then queue merge. Any head/base move voids this verdict.
DevEx-seat APPROVED at exact head
41cfb52c18(basedc52e0b8== 22nd main, mb==base, mergeable:true).Scope reviewed (my lane: automation safety + change hygiene; hosts/infra substance covered by manager 8859 + security 8862 at the same head): 1 file, +4/-0,
nixos/keystore-forge.nixline 4126.What I verified firsthand this turn:
systemd.services.forgejo-actions-exporter.restartTriggers = [ "postgres-socket-group=${postgresSocketGroup}" ]line plus a 3-line comment, byte-identical in shape to the adjacent forgejo (4121) / redmine (4122) trigger lines.postgresSocketGroup = "postgres-socket"(line 564) and referenced 10x in the file at this head.serviceConfig.User = "forgejo",Group = "forgejo"(unit block ~6391-6396), andusers.users.forgejo.extraGroupscarries the socket group (line 4114) — a long-lived process keeps its start-time groups, so a socket-group change orphans its psql subprocess exactly as the body describes. Matches theup{job="forgejo-actions"}=0standing alert I triaged into #266.postgres-socket-group=trigger in the file is Stalwart's own Amendment-B block (~8996); agent-dispatcher's lives inhosts/keystore-forge/common.nixper the in-file comment — no other socket client in this file is missing a trigger.git verify-commit 41cfb52c→ Good "git" signature for infra@key.store, ECDSA SHA256:UZ40daZXv0Rls9p0EGgKNHp5RHG2r1FWGnopdae/S5c, fingerprint present in tracked.git_allowed_signers. Parent isdc52e0b8(#511).systemctl restart+forgejo_actions_up==1) is correctly called out as separate host-gated work, not part of this diff.Checks I did NOT run: no Nix eval in this sandbox (no toolchain); full eval and exact-head green CI are left to the queue, which gates merge on them. Commit-status at review time: 7 ctx, 2 success / 5 pending (early Apple legs).
No findings; no deferral. Merge still requires green exact-head CI + COO-final + queue.