Skip to content

feature: a PgBouncer pooler for plugin databases, 100 connections kept for the panel, a Secret for plugin passwords, and nightly plugin database backups - #796

Merged
lukepolo merged 5 commits into
mainfrom
feature/plugin-db-pooler
Nov 23, 2026
Merged

lukepolo merged 5 commits into
mainfrom
feature/plugin-db-pooler

Conversation

@lukepolo

@lukepolo lukepolo commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Panel side of the plugin databases work (api#1000, web#1232).

  • Pooler: new plugin-db-pooler (PgBouncer 1.26.1, CloudNativePG's image, pinned by digest) in transaction mode. Game servers will connect through it, so many servers share up to 100 real connections per database. Only plugin_* login roles can authenticate (SCRAM pass-through via auth_query); every other user gets "no such user", so the api and Hasura keep connecting straight to timescaledb. The lookup function and pgbouncer_auth's CONNECT live in the postgres maintenance database; nothing touches Hasura's database. pgbouncer_auth gets a fresh password on each pod start, kept in a memory volume, so there is no new secret to add to env files or Vault.
  • Panel slots: TimescaleDB keeps 100 of its 500 connections for the hasura superuser the api and Hasura log in as, so plugins can never starve the panel. The database restarts once when this rolls out.
  • Passwords: an empty plugin-databases Secret, plus get/patch/update on that one Secret for the api. It has no data on purpose: panel updates run client-side kubectl apply, which only removes fields it applied before, so keys the api writes stay.
  • Backups: a new plugin-databases-backup CronJob (03:30, after the main one) dumps every plugin_* database on its own to plugin-databases/<name>/backup-<ts>.zip, keeping the newest 7 each, with owners kept so a restore hands the tables back to the plugin's role. It never touches the main backups. A retry skips any database that already has today's dump, pg_dump waits at most 300s for a lock, and the Job allows 2 retries and 2 hours. The main backup job is unchanged except that its pruning now counts only top-level backup-*.zip; before, it kept 7 keys across the whole bucket.
  • Config: pgbouncer.ini comes from a configMapGenerator, so a config change rolls the pooler.

Checked locally: the backup script tests (21/21, 9 new), the startup probe, host port and image update tests, both overlays render, and the pooler in Docker against TimescaleDB pg18.

@lukepolo
lukepolo marked this pull request as ready for review November 23, 2026 20:49
@lukepolo
lukepolo merged commit 987c68e into main Nov 23, 2026
4 checks passed
@lukepolo
lukepolo deleted the feature/plugin-db-pooler branch November 23, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant