Update to v26.04

Warning

Update to v26.04 must be performed from version v25.12.5.

In version v26.04, the PostgreSQL version has been updated, so when updating MITIGATOR you need to delete the database and restore it from a full backup. A script for creating a full database backup is included in version v25.12.5.

Preparation for Update

  1. Update all MITIGATOR instances to version v25.12.5 according to standard procedure.

  2. After starting MITIGATOR on version v25.12.5, wait for all migrations to complete and settings to propagate.

  3. Create a database backup on the MITIGATOR instance where the database is in Primary status:

    Warning

    To create a backup, execute the command below, which specifies backup_all.
    Using the standard command from the Backup article will NOT transfer all necessary data.

    docker-compose exec postgres sh -c 'backup_all > /tmp/backup_all.sql' 
    docker cp $(docker-compose ps -q postgres):/tmp/backup_all.sql .
  4. Verify that the backup was created without errors:

    tail backup_all.sql

    There should be no error messages in the output.

  5. Stop all MITIGATOR instances (first with Standby database, then with Primary):

    docker-compose down

Update to v26.04

  1. On all instances, write the version line to the .env file:

    VERSION=v26.04.X

    Here X is the target minor version.

  2. On all instances, download the current Compose file:

    wget https://docs.mitigator.ru/master/dist/docker-compose.yml -O docker-compose.yml
  3. On all instances, update the contents of docker-compose.failover.yml and docker-compose.worker.failover.yml files, if they are used.

    If docker-compose.failover.yml or docker-compose.worker.failover.yml are specified in the COMPOSE_FILE variable of the .env file, update them:

    Remove from pgfailover section:

     volumes:
       - failover:/trigger:rw

    Remove from postgres section:

     volumes:
       - failover:/failover:rw

    Remove the volumes section at the end of the file:

    volumes:
      failover:

    If docker-compose.failover.yml and docker-compose.worker.failover.yml files were used without modifications, instead of manual removal steps you can download new current files:

    wget https://docs.mitigator.ru/master/dist/multi/docker-compose.failover.yml -O docker-compose.failover.yml && \
    wget https://docs.mitigator.ru/master/dist/multi/docker-compose.worker.failover.yml -O docker-compose.worker.failover.yml
  4. On all instances, download new images:

    docker-compose pull
  5. On the MITIGATOR instance where the database is in Primary status, delete the database:

    docker volume rm mitigator_postgres
  6. On the MITIGATOR instance where the database is in Primary status, start Postgres:

    docker-compose run -d --rm --name postgres_idle postgres idle
  7. On the MITIGATOR instance where the database is in Primary status, open Postgres logs:

    docker logs -f postgres_idle
  8. On the MITIGATOR instance where the database is in Primary status, wait for the message database system is ready to accept connections, press Ctrl+C. Ignore messages role "repuser" does not exist.

  9. On the MITIGATOR instance where the database is in Primary status, copy the backup to the container and restore the data:

    docker cp backup_all.sql postgres_idle:/tmp/ && \
    docker exec postgres_idle sh -c 'psql mitigator </tmp/backup_all.sql >/tmp/restore.log'
  10. Stop the temporary Postgres container and start the main service:

    docker stop postgres_idle && \
    docker-compose up -d postgres && \
    docker-compose logs -f postgres
  11. Wait for the message database system is ready to accept connections, press Ctrl+C.

  12. On MITIGATOR instances where the database is in Standby status, delete the database:

    docker volume rm mitigator_postgres
  13. On MITIGATOR instances where the database is in Standby status, perform database initialization:

    docker-compose run --rm -e PGPORT=15432 postgres standby
  14. Start the MITIGATOR instance where the database is in Primary status:

    docker-compose up -d
  15. After startup, wait for all migrations to complete and settings to propagate.

  16. Start other MITIGATOR instances:

    docker-compose up -d