Thank you both @MairusuPawa and @dpoulton for the discussion on database versions -- I have updated the GitHub readme to now reference postgres:15 (Docker Hub will reflect these new instructions the next time a new version of Joplin server is released).
If you previously used Postgres 13 and wish to upgrade to Postgres 15, I was able to update my own database using the following procedure:
NOTE: This is fairly generic in that my joplin-data is mounted at /mnt/hdd/docker/volume/joplin-data, so replace this location throughout with wherever you keep your data mounted.
-
Create a backup of the database and then kill your running joplin-server and joplin-db containers:
docker exec joplin-db /bin/bash -c '/usr/bin/pg_dump -Fc -U joplin joplin' > /mnt/hdd/docker/volume/joplin-data/backup.dump
docker kill joplin-db joplin-server
-
At this point, move the mounted directory to some place else. For example:
mv /mnt/hdd/docker/volume/joplin-data /mnt/hdd/docker/volume/joplin-data-pg13
-
Update the Postgres version in the docker-compose.yml file. Example:
joplin-db:
image: postgres:15
-
Run the new image and allow the file structure to be created
docker compose up -d --force-recreate joplin-db joplin-server
-
Once the database is up and ready to accept connections (you can check this by viewing the logs), go ahead and copy the backup.dump file into the new volume mount, and import the database from the backup you created in step 1.
cp /mnt/hdd/docker/volume/joplin-data-pg13/backup.dump /mnt/hdd/docker/volume/joplin-data/
docker exec joplin-db pg_restore --clean -U joplin -d joplin /var/lib/postgresql/data/backup.dump
-
You're now running the latest supported version of PostgreSQL with Joplin, and all your notes are intact. Once you have verified everything is working, you can remove the old volume that you moved in step 2 as it's no longer needed:
rm -rf /mnt/hdd/docker/volume/joplin-data-pg13
3 Likes