Update to postgres 15 and run pg_upgrade automatically #15

Merged
iexos merged 3 commits from iexos/outline:pg15 into main 2023-06-19 11:32:40 +00:00
Member

created an entryscript that check for incorrect PG_VERSION. if so, it downloads the old binaries and performs an update via pg_upgrade

inspired by:

works well for migrating from postgres 11 as well as deploying a fresh instance

created an entryscript that check for incorrect `PG_VERSION`. if so, it downloads the old binaries and performs an update via `pg_upgrade` inspired by: - https://github.com/docker-library/postgres/issues/37 - https://github.com/tianon/docker-postgres-upgrade/tree/master/11-to-15 - https://github.com/bwbroersma/docker-postgres-upgrade/blob/cf5c8609a70952f01681d7fc4e55ed676bcd5faf/upgrade/docker-upgrade-entrypoint-wrapper.sh works well for migrating from postgres 11 as well as deploying a fresh instance
iexos added 1 commit 2023-06-15 14:18:12 +00:00
decentral1se reviewed 2023-06-15 14:55:26 +00:00
decentral1se left a comment
Owner

Great stuff!

Great stuff!
@ -0,0 +5,4 @@
NEWDATA=$PGDATA/new_data
if [ -e $MIGRATION_MARKER ]; then
echo "FATAL: previous migration not completed. manual restore necessary"
Owner

Can we help with a from which version to which we need to handle the manual restore with?

Can we help with a from which version to which we need to handle the manual restore with?
Author
Member

I don't know in which state the migration did not complete, its just a safety mechanism to stop interrupted migrations that are in an unclear state. With restore I mean to restore the hopefully made backup. Does this make it more clear?

I don't know in which state the migration did not complete, its just a safety mechanism to stop interrupted migrations that are in an unclear state. With restore I mean to restore the hopefully made backup. Does this make it more clear?
decentral1se marked this conversation as resolved
@ -0,0 +19,4 @@
postgresql-$DATA_VERSION \
&& rm -rf /var/lib/apt/lists/*
echo "shuffling around"
gosu postgres mkdir $OLDDATA $NEWDATA
Owner

Is gosu definitely already installed? I guess it could be included in the apt-install stuff above to help make it more portable. Just noting this thought in case it's useful.

Is `gosu` definitely already installed? I guess it could be included in the `apt-install` stuff above to help make it more portable. Just noting this thought in case it's useful.
Author
Member

gosu is used in the vendor docker-entrypoint.sh. Its not portable to -alpine, but wouldn't be with apt-install either

`gosu` is used in the vendor `docker-entrypoint.sh`. Its not portable to `-alpine`, but wouldn't be with `apt-install` either
decentral1se marked this conversation as resolved
iexos added 1 commit 2023-06-15 16:54:04 +00:00
Owner

LGTM @iexos! Perhaps some Autonomicz have some thoughts on this as they maintain Outline stuff too /cc @3wordchant @cas @knoflook Not sure who else to ping atm, feel free to merge from my side

LGTM @iexos! Perhaps some Autonomicz have some thoughts on this as they maintain Outline stuff too /cc @3wordchant @cas @knoflook Not sure who else to ping atm, feel free to merge from my side
Owner

We hot tested this on our outline and it worked, modulo a tiny change without which it fails in a most alarming manner, see inline.

We hot tested this on our outline and it worked, modulo a tiny change without which it fails in a most alarming manner, see inline.
iexos added 1 commit 2023-06-18 21:04:09 +00:00
iexos merged commit 7d2f35277b into main 2023-06-19 11:32:40 +00:00
iexos deleted branch pg15 2023-06-19 11:32:41 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coop-cloud/outline#15
No description provided.