Help Needed: Upgrading postgres version from postgres:14-alpine to postgres:16-alpine
Is this a feature for the backend or frontend?
Backend
What would you like?
Hi, I need some help or suggestions.
Current Planka version: 1.24.1
In the Planka GitHub repository, the docker-compose.yml file specifies the image for PostgreSQL as:
image: postgres:16-alpine
However, on my premises, it's currently set to:
image: postgres:14-alpine
I would like to update my docker-compose.yml file to use postgres:16-alpine.
- Should I proceed with this update?
- Will Docker Compose handle the upgrade without any issues, or do I need to prepare or adjust anything beforehand?
Thank you for your guidance!
Why is this needed?
N/A
Other information
N/A
Hi! We'll add this to the docs soon.
Thank you for your response.
So these are the steps i followed that worked successfully -
- Backup your database (x2 to be safe)
docker compose exec postgres pg_dump -U postgres -d planka -cC > upgrade_backup_pg14.sql
- Shutdown database, create a backup volume and do a volume backup (you may have to adjust names)
docker compose down
docker volume create planka_database_backup
docker run --rm -v docker-planka_db-data:/from -v planka_database_backup:/to alpine sh -c 'cd /from && cp -a . /to'
- Make sure step 2 is done and you have the sql and data volumes, then remove the old volume (why docker dont add a docker rename volume option..?)
docker volume rm docker-planka_db-data
-
Edit the
docker-compose.ymlandnetwork_mode: noneto the postgres config and changeimage: postgres:14-alpinetoimage: postgres:16-alpine -
Pull the updated image, force recreate postgres database and apply your backup
docker compose pull
docker compose up --force-recreate -d postgres
cat upgrade_backup_pg14.sql | docker compose exec -T postgres psql -U postgres
- Edit
docker-compose.ymland remove thenetwork_mode: none, then rerun the recreate
docker compose up --force-recreate -d
Test!
PS thanks for an awesome open source project
Hi,
I am having an error when I try to run docker compose up --force-recreate -d postgres. I made sure that I follow the previous steps.
postgres-1 | postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization postgres-1 | postgres-1 | 2025-03-02 23:57:08.965 UTC [1] FATAL: database files are incompatible with server postgres-1 | 2025-03-02 23:57:08.965 UTC [1] DETAIL: The data directory was initialized by PostgreSQL version 14, which is not compatible with this version 16.8. postgres-1 exited with code 1