thermograph/deploy
Emi Griffith 213b3818e7 Add a Postgres advisory-lock leader election for multi-host deploys (#229)
The subscription notifier elects one leader via a host-local flock
(THERMOGRAPH_SINGLETON_LOCK) so multiple uvicorn workers on one host don't
each run it. Under multi-host Swarm that guard is insufficient: each host
would independently elect its own leader, multiplying Open-Meteo quota use
N-fold again.

Add claim_pg(key) alongside the existing claim(lock_path): a cluster-wide
Postgres advisory lock, visible to every host talking to the same database.
The holding connection is dedicated and kept for the process lifetime
(advisory locks are session-scoped); a dead connection is dropped and
re-election retried on the next call.

claim_leader() dispatches between the two mechanisms from env:
THERMOGRAPH_SINGLETON_PG (+ Postgres) -> claim_pg; else
THERMOGRAPH_SINGLETON_LOCK -> claim; else always leader, unchanged. Wired in
at web/app.py in place of the direct claim() call. Off by default, so
today's single-host behavior is unaffected.
2026-07-21 00:07:52 +00:00
..
db Move the climate record from parquet to TimescaleDB hypertables (#227) 2026-07-20 20:15:55 +00:00
openmeteo Scale DB tuning from DB_MEMORY; order Docker after the rclone mount (#226) 2026-07-20 14:33:09 +00:00
Caddyfile Serve the app on thermograph.org at root; redirect emigriffith.dev/thermograph (#91) 2026-07-15 19:58:32 +00:00
deploy.sh Containerize the app and move the databases to PostgreSQL 18 (#220) 2026-07-20 06:28:23 +00:00
POSTGRES-MIGRATION.md Move the climate record from parquet to TimescaleDB hypertables (#227) 2026-07-20 20:15:55 +00:00
provision-mail.sh Rebuild the homepage as a distribution landing; add an SMTP seam (#178) 2026-07-18 07:39:47 +00:00
thermograph-dev.service Add dev CI/CD pipeline deploying to a LAN server (#6) 2026-07-11 02:13:18 +00:00
thermograph.env.example Add a Postgres advisory-lock leader election for multi-host deploys (#229) 2026-07-21 00:07:52 +00:00
thermograph.service Containerize the app and move the databases to PostgreSQL 18 (#220) 2026-07-20 06:28:23 +00:00