• 1 Post
  • 4 Comments
Joined 1 year ago
cake
Cake day: June 27th, 2023

help-circle

  • tko@tkohhh.socialOPtoLemmy Support@lemmy.ml0.19.4 Prerequisites
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    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:

    1. 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
    3. docker-compose up -d for the lemmy instance (the only container running at this point will be postgres)
    4. 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 ran docker exec -it [container name] bash, and then ran pgdumpall -U [username] -f /miscfiles/pgdumpall20240628. The end result is a dumpall file saved in the ./volumes/miscfiles directory on the host machine)
    5. docker-compose down
    6. mv ./volumes/postgres ./volumes/postgresBAK20240628 (move your existing postgres data to a new directory for backup purposes)
    7. mkdir ./volumes/postgres (re-create an empty postgres data folder. make sure the owner and permissions match the postgresBAK20240628 directory)
    8. edit the docker-compose.yml and update the postgres image tag to the new version
    9. docker-compose up -d (you’ll now have a brand new postgres container running with the new version)
    10. docker-exec -it [container name] psql -U [username] -f /miscfiles/pgdumpall20240628 (again, I think this will work, but I bashed 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.)
    11. docker-compose down
    12. edit the docker-compose.yml and un-comment all of the other services that you commented out in step 2
    13. docker-compose up -d

    Hopefully that helps anyone that might need it!