Branching: declare pg_cron jobs and generated Vault secrets per branch in config.toml #54372
Unanswered
martijn00
asked this question in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Some database setup differs per branch and has no place in migrations, seeds or
config.toml: whichpg_cronjobs run, the Vault secrets they read, and the URLs they call withpg_net. Today it is SQL someone runs by hand on each branch, and again after every reset.Our case
A multi-tenant app deploys
mainand a persistentdevelopbranch. Production gets its background-job schedule from the hosting platform. Thedevelopdeployment gets no platform schedule, so thedevelopdatabase calls a drain route every minute withpg_cronandpg_net, authenticated with a random bearer key it generates into Vault. Production must not run that job, and the key must differ per branch and never sit in a file.None of this can go in a migration or a seed, because migrations and seeds are the same on every branch (and production seeding is off). So the setup lives in a runbook: after each reset of
develop, someone runs an idempotent snippet withvault.create_secret(...)andcron.schedule(...), and until then no background job runs there.Ask
Declare these per remote in
config.toml, applied by the branching workflow and bysupabase startanddb resetlocally:A job declared for one remote is absent everywhere else, so a restored project or a new branch doesn't start running production jobs (as asked in #53056).
Related
config.toml, the same idea for another kind of per-branch database setup.[remotes.<branch>.db.vault]exists, but only takes values from env files, so a per-branch random key still has to be created and copied by hand.All reactions