Skip to main content

Migrating PostgreSQL 11 to 16 (Linux w/ Docker)

PostgreSQL 16 is supported starting with Informer 5.8.6 and required as of Informer 5.9. When upgrading from a version before 5.8.6 that is not yet on PostgreSQL 16, the upgrade installer handles the bulk of this migration. For help, contact Support at i5support@entrinsik.com or schedule time via the Informer install Calendly.

Postgres 16 image and auth method

Informer requires a specific Postgres 16 image with the vector extension, and Postgres 16 needs a new environment variable for its auth method. Both appear in the docker-compose.yml example below.

What happens during the migration

  1. Back up the PostgreSQL 11 databases.
  2. Delete the PostgreSQL 11 container.
  3. Deploy the PostgreSQL 16 container.
  4. Restore the databases into the PostgreSQL 16 container.
  5. Start Informer and apply the final migrations.

Back up the PostgreSQL 11 databases

  1. Create a backup of the PostgreSQL 11 database using the commands in Backups and restores (Linux w/ Docker), and make sure the backup file is copied to the host machine.

  2. Rename the existing pgdata folder and create a new, empty one for PostgreSQL 16:

    mv ./pgdata ./pgdata11
    mkdir ./pgdata

Delete the PostgreSQL 11 container

With the database backed up, remove the PostgreSQL 11 container:

docker-compose rm postgres

Deploy the PostgreSQL 16 container

Edit docker-compose.yml and change the postgres service to use the PostgreSQL 16 image. The result should look like:

postgres:
image: pgvector/pgvector:pg16
environment:
- POSTGRES_USER=i5
- TZ=US/Pacific
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
- ./pgdata:/var/lib/postgresql/data

Restore the databases into PostgreSQL 16

  1. Pull the updated PostgreSQL 16 image:

    docker-compose pull
  2. Start the new PostgreSQL container:

    docker-compose up -d postgres
  3. Copy the backup into the container and restore it:

    docker cp ./backup_all.sql <postgresql_container_name>:./backup_all.sql
    docker-compose exec postgres psql -U i5 -f backup_all.sql

Start Informer and apply final migrations

With PostgreSQL 16 running and holding the data, continue the rest of the 5.8.6 upgrade. When it finishes, Informer restarts and applies a few automatic migration steps, which can take a few minutes. Monitoring the Docker logs shows you when the migrations finish.