Issue upgrading Joplin Server on Docker

Operating system

Linux

Joplin version

2.13.12

What issue do you have?

Hello
I run Joplin Server v2.13.3 in docker on a synology NAS successfully with postgreSQL v15.
When I try to upgrade to the lastest postgreSQL 16.1 I run into the error that the data directory was initialized with version 15 which is incompatible to version 16.1 (pls see the attached screenshot).

How can I upgrade my database to version 16.x ?

Thanks a lot, Michael

Screenshots

1 Like

I've done this a few days ago. I have note some snippets on my wiki... :thinking:

First of all, make a. Backup.
Second step, really make a backup. I'm only a copy&paste admin...

Then, you have start the old postgresql container again and make a dump file from the database. I've done this with:

docker exec joplin_db /bin/bash -c '/usr/bin/pg_dump -Fc -U joplin joplin' > /home/user/joplin-server/database-backup/backup.dump

After that I stopped the docker stack and switched to the new version of postgresql.
The postgresql container will setup a complete knew database.

After all containers are booted up again I copied the dump file in a folder that is mounted to the postgresql container.

Then I imported the dumpfile into the new database:

docker exec joplin_db pg_restore --clean -U joplin -d joplin /var/lib/postgresql/data/backup.dump
3 Likes

Hi!
Thanks for your answer.

After that I stopped the docker stack and switched to the new version of postgresql.
The postgresql container will setup a complete new database.

How did you made sure that not the existing db files are picked up again? Did you simply moved the files?
I assume:

  1. you stopped the stack
  2. made a backup
  3. dump the v15 database
  4. moved the joplin folder to something else
  5. change the postgreSLQ version to latest
  6. start the stack and run let postgreSQL setup a new database
  7. import the dump

Anything I have missed?

Yes, you are right. I've moved everything simply to a backup folder, before I started the new postgresql version. The ne container needs an empty data folder.

Your way looks good. :+1:

2 Likes

@MoriarT3a thanks for posting this.

I had been meaning to get around to doing this for ages. Your post helped a lot. I did remember to move my original mapped volume folder before starting up the new Postgres docker container and all went well! The bit that was putting me off from staring the upgrade was working out the Postgres dump and import commands and how to run them within the container. Your post saved me a LOT of searching and experimenting.

Thanks again!!! :+1:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.