Migrate Taiga Docker from Postgresql-12 to Postgresql-14

Hi there :wave:

this post show a path to migrate your Taiga docker installation from current Postgresql-12 to Postgresql-14. It’s meant for a basic installation of Taiga; if you have a different configuration or specific extensions in Postgresql, you will have to adapt the steps to your needs.

Note that this tutorial takes for granted that you can stop your self-hosted Taiga service for a (little) while. Let’s start!

Stop your Taiga services

The reason is prevent the users from writing in the database after the backup is done. You may stop your host proxy server as well.

docker-compose down

Prepare the database for the backup

Edit your docker-compose.yml file to expose the database to your host in a free port. To do so, add in your taiga-db service the section something like:

  - "5432:5432"

Now, we deal with the only Taiga related topic in this guide: deleting a function that is not compatible with Postgresql-14, and it’s really not needed anymore.

psql -U taiga -h localhost taiga -c "DROP AGGREGATE IF EXISTS array_agg_mult (anyarray);"

Create the backup and clean the previous volume

To create a backup, we use the pg_dump instruction:

pg_dump -U taiga -h localhost -Fc -Z 9 --file=taiga.sql taiga

This may take a while depending on the size of your database. Once you have it, we recommend that you test the dump is correct, by restoring the data from the file. You’re about to delete your old database so be sure you have a proper backup.

It’s time we stop the database and delete the volume:

docker-compose down
docker volume rm taiga-docker_taiga-db-data

Restore the backup and run it all

Now, change your docker-compose.yml so the taiga-db service uses the image postgres:14.

Run only the database, so no migrations are not applied:

docker-compose up -d taiga-db

And restore the backup in the database:

pg_restore -U taiga -h localhost -d taiga taiga.sql

Make some queries in the database to test everything is correct. Then, delete the ports section in the docker-compose.yml file and run it all with:

docker-compose up -d

If you stopped the proxy in the first step, you should start it again and everything should be working as before.