Add pg-boss background job queue with session expiry

Add @trails-cool/jobs package wrapping pg-boss for durable background job
execution using the existing PostgreSQL database. Wire up planner session
expiry as the first scheduled job (hourly, 7-day TTL) — this was previously
dead code that never ran. Add placeholder worker to journal for future
Komoot import and federation jobs.

Infrastructure: grant grafana_reader access to pgboss schema, add job queue
health panels to Service Health dashboard, add failed job alert.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-04-13 21:17:24 +02:00
parent fc80e66ad4
commit 32c5fbde8f
25 changed files with 614 additions and 6 deletions

View file

@ -31,5 +31,10 @@ BEGIN
GRANT SELECT ON ALL TABLES IN SCHEMA journal TO grafana_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA journal GRANT SELECT ON TABLES TO grafana_reader;
END IF;
IF EXISTS (SELECT 1 FROM information_schema.schemata WHERE schema_name = 'pgboss') THEN
GRANT USAGE ON SCHEMA pgboss TO grafana_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA pgboss TO grafana_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA pgboss GRANT SELECT ON TABLES TO grafana_reader;
END IF;
END
$$;