Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help Needed: Upgrading postgres version from postgres:14-alpine to postgres:16-alpine #949

Open
jaimedmp opened this issue Nov 19, 2024 · 4 comments

Comments

@jaimedmp
Copy link

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

@meltyshev
Copy link
Member

Hi! We'll add this to the docs soon.

@jaimedmp
Copy link
Author

Thank you for your response.

@nbx3
Copy link

nbx3 commented Feb 14, 2025

So these are the steps i followed that worked successfully -

  1. Backup your database (x2 to be safe)
docker compose exec postgres pg_dump -U postgres -d planka -cC > upgrade_backup_pg14.sql
  1. 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'
  1. 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
  1. Edit the docker-compose.yml and network_mode: none to the postgres config and change image: postgres:14-alpine to image: postgres:16-alpine

  2. 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
  1. Edit docker-compose.yml and remove the network_mode: none, then rerun the recreate
docker compose up --force-recreate -d

Test!

PS thanks for an awesome open source project

@jaimedmp
Copy link
Author

jaimedmp commented Mar 3, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants