feat(supabase): PG15->17 in-place migration tooling + runbook#81
Open
Carlos-Vera wants to merge 1 commit into
Open
feat(supabase): PG15->17 in-place migration tooling + runbook#81Carlos-Vera wants to merge 1 commit into
Carlos-Vera wants to merge 1 commit into
Conversation
Adds tooling to migrate an existing EasyPanel-hosted Supabase stack from Postgres 15 to 17 in place, preserving data -- the counterpart to the image bump in easypanel-io#80. - utils/upgrade-pg17.easypanel.sh: autodetects db container / data dir / db-config by compose project label (no container_name assumption), --conversion-only mode so EasyPanel keeps owning start/stop, and REGEN_DB_CONFIG to regenerate db-config from the PG17 image while preserving pgsodium_root.key (Gotcha A). - utils/post-upgrade-pg17-roles.sh: post-start role/collation migrations that pg_upgrade does not carry over. - utils/regen-db-config.sh: standalone db-config regeneration (Gotcha A contingency), preserving the pgsodium key. - docs/RUNBOOK-easypanel-pg15-to-17.md: step-by-step runbook. The PG17 image bump (easypanel-io#80) and the rest/functions healthchecks (easypanel-io#79) are proposed separately; this branch adds only the migration tooling and docs. Autor: Carlos Vera <carlos@braveslab.com> --- De un venezolano para el mundo con el favor de nuestro Señor JesusCristo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds the tooling to migrate an existing EasyPanel-hosted Supabase stack from Postgres 15 to 17 in place, keeping the data — three scripts + a step-by-step runbook under
supabase/code/. No image or service versions change here; this is the migration counterpart to the bump in #80.Why it's separate from #80
#80 is one line (the image bump) and can be judged on its own. This is the part that answers "ok, but how does someone with a running 15 stack actually move?" — kept apart so you can take one without the other.
What's in it
utils/upgrade-pg17.easypanel.sh— the conversion. Autodetects the db container / data dir / db-config by compose project label (EasyPanel doesn't setcontainer_name, so nothing is hardcoded), runs Supabase's owninitiate.sh/complete.shfrom a one-off container,--conversion-onlyso EasyPanel keeps owning start/stop, keepsdata.bak.pg15for rollback.utils/regen-db-config.sh— regenerates thedb-configvolume from the 17 image while preservingpgsodium_root.key(see Gotcha A below).utils/post-upgrade-pg17-roles.sh— the role/collation migrationspg_upgradedoesn't carry over.docs/RUNBOOK-easypanel-pg15-to-17.md— the whole thing, step by step, with backup and rollback.Tested
Ran it on a real EasyPanel deployment (
15.8.1.085→17.6.1.150): 17.6 healthy, all containers up, infra preserved. Also locally against a stack replicating the EasyPanel layout with an app schema + RLS + seeded rows — every table's md5 byte-identical before/after, vault still decrypting.pg_upgradeitself is seconds; wall-clock is image pulls.Gotcha A: the db-config volume
The
db-configvolume (mounted at/etc/postgresql-custom) survives the upgrade and can carry a PG15 setting that 17 rejects — the db then loops onconfiguration file ".../supautils.conf" contains errors. It didn't trigger on15.8.1.085 → 17.6.1.150(17 tolerates the one real drift, a renamedsupautils.*GUC), but I reproduced it by injecting a parameter removed after 15. The fix regenerates db-config from the 17 image while preservingpgsodium_root.key— drop that key and vault comes back withinvalid secret key. Handled behind a flag, with a standalone contingency script.The honest part: is this the right tool for the EasyPanel user?
A gut check, because here it matters more than the code. Someone running Supabase through EasyPanel mostly chose it to not touch a terminal. This path still needs SSH (or the service web console) + running a script. It works, but it's not "click a button".
A few open questions I don't think should be waved away:
pg_dumpall+ restore may feel less scary than apg_upgradescript they can't read.Not trying to solve that here — just flagging it so the call on #80 is made with the non-technical user in mind, not only the mechanics.