-
-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch PostgreSQL container to use pgautoupgrade #4892
Conversation
This handles automatically upgrading the data files to newer versions of PostgreSQL.
Thx! I had no idea this existed, and I love it. |
Looks good, please change the one in |
|
I'll make the requested changes soon. |
As a data point, we've added Debian based pgautoupgrade images now too ( If your existing PostgreSQL docker image is Debian based, then it's best to use a Debian based pgautoupgrade image. That's because we've had reports of collation problems when people upgraded their Debian based PostgreSQL image using our original (Alpine based) images. These new images should fix that. 😄 |
Heh, and now I've looked at the actual PR (a simple 1-liner), and it's alpine based anyway. You should be good to go. 😄 |
I've fixed the other cases now. |
Thanks. Sorry I didn't get to it - I've been busy with other things. |
No probs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving under the condition we have tested in CI and its passing. (Oh, wrong repo, but reviewed anyway!)
scripts/postgres_15_to_16_upgrade.sh
Outdated
@@ -24,7 +24,7 @@ echo "Removing the old postgres folder" | |||
sudo rm -rf volumes/postgres | |||
|
|||
echo "Updating docker compose to use postgres version 16." | |||
sudo sed -i "s/image: .*postgres:.*/image: docker.io\/postgres:16-alpine/" ./docker-compose.yml | |||
sudo sed -i "s/image: .*postgres:.*/image: pgautoupgrade\/pgautoupgrade:16-alpine/" ./docker-compose.yml | |||
|
|||
echo "Starting up new postgres..." | |||
sudo docker compose up -d postgres |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @ticoombs mentioned, these migration scripts arent needed anymore. However they are still linked in Lemmy release announcements, so I would leave them in but remove everything except for this line:
sudo sed -i "s/image: .*postgres:.*/image: pgautoupgrade\/pgautoupgrade:16-alpine/" ./docker-compose.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* Switch PostgreSQL container to use pgautoupgrade This handles automatically upgrading the data files to newer versions of PostgreSQL. * Fixing other uses of postgres:16-alpine image. * Simplifying upgrade scripts. --------- Co-authored-by: Dessalines <tyhou13@gmx.com>
Lemmy changed from PostgreSQL 15 to 16 at some point, and trying to switch from 15 to 16 in
docker-compose.yml
results in errors like this at startup:This PR changes the PostgreSQL container to use pgautoupgrade. The pgautoupgrade image is based on the regular PostgreSQL one, but it automatically updates the data to the newer format on startup. This avoids users having to figure it out manually.