Skip to content

[SD-331] - Update docker compose

Closes SD-331

The docker compose files were using image: postgres:14-alpine. This caused migration using syntax that was introduced in later versions like NULLS to fail. The MR updates the docker compose files to use the latest stable version (version 17).

This solution will work out of the box for clean installs only.

If you are currently using postgres through docker make sure to back up and restore your data before updating your main branch. From the root of your back-end repo

  1. Back-up existing data using image: postgres:14-alpine with: docker exec bare-postgres-1(or the correct container name) pg_dumpall -c -U postgres > backup.sql 2.Test that the data is correct in a temporary postgres 17 container:
  • Create the container
docker run -d --name temp-postgres17 \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=postgres \
  postgres:17-alpine
  • Move the data cat backup.sql | docker exec -i temp-postgres17 psql -U postgres

  • Verify the data docker exec -it temp-postgres17 psql -U postgres -d postgres

  1. Stop and remove your current postgres container (this example uses the docker-compose-bare.yml)

docker-compose -f ./support/docker/docker-compose-bare.yml rm -sf postgres

  1. Update your branch and start the new and clean container

cat backup.sql | docker exec -i bare-postgres-1 psql -U postgres

  1. Clean-up after verifying the data

docker rm -f temp-postgres17

rm backup.sql

Edited by Orestis Athanasopoulos Antoniou

Merge request reports

Loading