The main idea is to understand the steps we need to do to properly upgrade the postgresql version. Unlike the penpot application, you can’t just increase the version number, this is because postgresql major version upgrade can’t be done without explicit intervention.
This small guide intends to explain how to proceed for a proper upgrade of postgresql running in a container. Take care that the volume and container names are used in the examples of this guide are for our devenv. You should adapt the names to those used in your environment.
First, ensure you have stopped all penpot related containers:
docker compose -p penpotdev -f docker/devenv/docker-compose.yaml stop
Rename in the compose file the postgresql related volume to
posgres_data_pg15 (this is needed for ensure that compose is the owner of the volume), and run the create docker compose sub-command:
docker compose -p penpotdev -f docker/devenv/docker-compose.yaml create
This will create the containers and the volumes prefixed with the
penpotdev, if you are using another prefix, ensure you are using correct names and correct versions.
The next step is to perform the upgrade. To facilitate it, we have created the
docker/postgres-upgrade.sh script located in the penpot repository.
So let’s proceed with the upgrade using a temporal container:
docker run -ti --rm \ -v "$(pwd)/docker/postgres-upgrade.sh:/bin/postgres-upgrade.sh" \ -v "penpotdev_postgres_data:/var/lib/postgresql/13/data" \ -v "penpotdev_postgres_data_pg15:/var/lib/postgresql/15/data" \ postgres:15 postgres-upgrade.sh 13
Once verified that everything has gone well, we can proceed to delete the old volume with:
docker volume rm penpotdev_postgres_data