feat(web-arm): fetch PowerSync sync rules live from Cloonar/fit #96
No reviewers
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos!96
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/95"
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?
What
Source the deployed PowerSync sync rules live from
Cloonar/fit:powersync/sync-rules.yaml@masterinstead of the vendored, hand-copiedhosts/web-arm/modules/powersync/sync-rules.yaml. App-team rules changes now reach prod within ~5 min with no nixos edit; the fit PR review is the gate.service.yamlstays nix-rendered (it carries the sops DSN / storage / JWKS).How
powersync-syncrules-fetch.service(root oneshot) +.timerevery 5 min, also runs at boot. Fetches over the Forgejo raw API (GET /api/v1/repos/Cloonar/fit/raw/powersync/sync-rules.yaml?ref=master,Authorization: token <T>) with the read-onlyreptide-powersync-syncrules-token, fed as a systemd credential (thefueltide-backuppattern), not an on-disk env file.bucket_definitionstop-level key (the last check rejects a Forgejo JSON error body, which is itself valid YAML)..prev, thensystemctl try-restart podman-powersync.service(no-op when the container isn't running, e.g. at boot — PowerSync re-reads rules only on restart)./probes/liveness; if PowerSync doesn't come healthy, restore.prev, restart, and exit non-zero → page.podman-powersyncisAfter=/Requires=the fetch unit. Agit.cloonar.comblip keeps the persisted file (exit 0, never blocks the container); only a truly fresh host with no usable file hard-fails — that blocks startup and pages.service.yamlbind-mounted from the nix store,sync-rules.yamlfrom/var/lib/powersync— two file mounts so the mutable file isn't nested inside a read-only store mount. In-container paths unchanged.sync-rules.yamldeleted, no seed file.Decision raised (per the issue): paging via
OnFailure=, not a Grafana metric ruleThe issue listed two paging options. I used
OnFailure=→ Pushover (priority 1 =cp_dominik_normal) rather than a Grafana rule onnode_systemd_unit_state{...,state="failed"} == 1, because web-arm's local node-exporter does not enable thesystemdcollector — only the sharedutils/modules/victoriametricsdoes; web-arm rolls its ownvictoriametrics.nixwith justservices.prometheus.exporters.node.enable = true. That series is therefore never scraped forweb-arm:9100, so the proposed Grafana rule would have silently never fired.OnFailure=needs no metrics pipeline and fires immediately, still reusing the existing Pushover account. (Thejourneyapps/powersync-serviceimage also exposes no documented cheap sync-rules validate subcommand, so the YAML/structure gate + post-restart liveness rollback are the validation, as the issue allows.)Verification
scripts/test-configuration web-arm) passes —:: web-arm OK.nixpkgs-fmt --checkclean;nix-instantiate --parseclean.GET /api/v1/repos/Cloonar/nixos/raw/CONTEXT.md?ref=mainreturns the raw file, confirming the/raw/{path}?ref=shape; theAuthorization: token <T>format is the documented Forgejo API auth.fitrepo, the change-detection swap + container restart, the liveness rollback, and the Pushover page all exercise only on web-arm after deploy. Suggested post-deploy checks:systemctl start powersync-syncrules-fetch.service && journalctl -u powersync-syncrules-fetch.service— confirm a 200 fetch and either "unchanged" or a swap + restart.cat /var/lib/powersync/sync-rules.yamlmatches fit@master; a second run with no upstream change is a silent no-op.Closes #95