this post was submitted on 26 Jun 2024
11 points (100.0% liked)
Lemmy Support
4622 readers
22 users here now
Support / questions about Lemmy.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I successfully migrated postgres 15 to 16. I followed the general idea of the guide you posted, but I found it a little easier to do a slightly different process. Here's what I did:
docker-compose down
for the lemmy instance~~2. edit the
docker-compose.yml
file and comment out all of the services except postgres. In addition, add a new volume to the postgres service that looks something like this:- ./volumes/miscfiles:/miscfiles
~~docker-compose.yml
file and add a new volume to the postgres service that looks something like this:- ./volumes/miscfiles:/miscfiles
docker-compose up -d postgres
(this starts just thepostgres
service from the docker compose file)docker exec -it [container name] pg_dumpall -U [username] -f /miscfiles/pgdumpall20240628
(I think this will work, but it's not exactly what I did... rather, I randocker exec -it [container name] bash
, and then ranpgdumpall -U [username] -f /miscfiles/pgdumpall20240628
. The end result is a dumpall file saved in the./volumes/miscfiles
directory on the host machine)docker-compose down
mv ./volumes/postgres ./volumes/postgresBAK20240628
(move your existing postgres data to a new directory for backup purposes)mkdir ./volumes/postgres
(re-create an empty postgres data folder. make sure the owner and permissions match thepostgresBAK20240628
directory)docker-compose.yml
and update the postgres image tag to the new versiondocker-compose up -d postgres
(you'll now have a brand new postgres container running with the new version)docker-exec -it [container name] psql -U [username] -f /miscfiles/pgdumpall20240628
(again, I think this will work, but Ibash
ed in and ran the command from within the container. This also allows you to watch the file execute all of the commands... I don't know if it will do that if you run it from the host.)docker-compose down
~~12. edit the
docker-compose.yml
and un-comment all of the other services that you commented out in step 2~~docker-compose up -d
Hopefully that helps anyone that might need it!
edited to reflect the comment below
If you only want to start 1 service of your entire compose file just use the name in the service section. No need to comment out everything else. For Lemmy it would be:
docker compose up -d postgres
This will only start the postgres container of this stack. Glad you found a way which worked for you ☺️
ahhhh yes, that makes perfect sense... thank you for pointing that out! Especially since I'm not good enough with
vi
to know how to bulk delete the first character in specific lines, I had to manually arrow and delete.