Migrate PostgreSQL cluster to PG14 #625

Merged
raucao merged 19 commits from feature/postgresql_migration into master 2026-04-12 14:16:22 +00:00
Owner

Adds a bunch of management scripts and other changes to aid with cluster migration by replication.

Since physical replication is not supported between major versions, we set up a new standalone primary/cluster, import a dump from the current cluster, and then use logical replication to keep data in sync until the switchover.

See doc/postgres/migration.md for the full migration runbook and usage of scripts.

closes #504

Databases

  • akkounts
  • akkounts_queue
  • mastodon
  • gitea
  • drone
  • nbxplorer
  • btcpayserver
  • lndhub
  • ejabberd
  • ejabberd_5apps
Adds a bunch of management scripts and other changes to aid with cluster migration by replication. Since physical replication is not supported between major versions, we set up a new standalone primary/cluster, import a dump from the current cluster, and then use logical replication to keep data in sync until the switchover. See `doc/postgres/migration.md` for the full migration runbook and usage of scripts. closes #504 ## Databases * [x] akkounts * [x] akkounts_queue * [x] mastodon * [x] gitea * [x] drone * [x] nbxplorer * [x] btcpayserver * [x] lndhub * [x] ejabberd * [x] ejabberd_5apps
raucao added the kredits-3ops labels 2026-04-10 04:31:21 +00:00
raucao added 3 commits 2026-04-10 04:31:22 +00:00
raucao self-assigned this 2026-04-10 04:31:28 +00:00
greg was assigned by raucao 2026-04-10 04:31:28 +00:00
raucao added 1 commit 2026-04-10 04:37:02 +00:00
raucao added 1 commit 2026-04-10 04:38:22 +00:00
raucao added 1 commit 2026-04-10 08:49:45 +00:00
raucao added 1 commit 2026-04-10 08:58:19 +00:00
raucao changed title from Migrate PostgreSQL cluster to PG14 to WIP: Migrate PostgreSQL cluster to PG14 2026-04-10 13:43:33 +00:00
fsmanuel reviewed 2026-04-11 09:28:25 +00:00
@@ -0,0 +1,9 @@
#!/bin/bash
cd /tmp && \
(pg_dumpall --globals-only > globals.sql) && \
psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN (''template0'',''postgres'')" | \
Member

Why is it template0 instead of template1 like in all the other places?

Why is it `template0` instead of `template1` like in all the other places?
Author
Owner

Ohai @fsmanuel, (very) long time no see!

That's a good catch, it should be template1, because template0 is automatically excluded by the preceding condition (it doesn't allow connections).

Thanks! 🙏

Ohai @fsmanuel, (very) long time no see! That's a good catch, it should be `template1`, because `template0` is automatically excluded by the preceding condition (it doesn't allow connections). Thanks! 🙏
raucao added 8 commits 2026-04-11 11:24:19 +00:00
Queries can spawn more processed and then use more RAM than
`shared_buffers`
Reset to normal/final
Typo (not using pumactl), but we don't need to specify it to do the
right thing anyway. systemd can just send sigterm on its own.
Required by our Mastodon cookbook
raucao changed title from WIP: Migrate PostgreSQL cluster to PG14 to Migrate PostgreSQL cluster to PG14 2026-04-11 11:24:37 +00:00
raucao requested review from fsmanuel 2026-04-11 11:24:43 +00:00
Author
Owner

Added more changes and fixes, as well as the new cluster node configs. I think we're ready to merge...

Added more changes and fixes, as well as the new cluster node configs. I think we're ready to merge...
raucao added 1 commit 2026-04-11 11:35:07 +00:00
greg reviewed 2026-04-12 11:40:39 +00:00
@@ -0,0 +7,4 @@
role "replica_logical"
end
# primary = postgresql_primary
Owner

Were these lines left here intentionally?

Were these lines left here intentionally?
Author
Owner

Not really, just didn't care I guess. I removed them.

Not really, just didn't care I guess. I removed them.
raucao added 2 commits 2026-04-12 12:11:50 +00:00
greg approved these changes 2026-04-12 13:54:10 +00:00
greg left a comment
Owner

👍

👍
raucao added 1 commit 2026-04-12 14:15:27 +00:00
raucao merged commit be0d7105d3 into master 2026-04-12 14:16:22 +00:00
raucao deleted branch feature/postgresql_migration 2026-04-12 14:16:23 +00:00
Sign in to join this conversation.
No Reviewers
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kosmos/chef#625