Update to v26.04
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
-
Update all MITIGATOR instances to version v25.12.5 according to standard procedure.
-
After starting MITIGATOR on version v25.12.5, wait for all migrations to complete and settings to propagate.
-
Create a database backup on the MITIGATOR instance where the database is in Primary status:
WarningTo 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 . -
Verify that the backup was created without errors:
tail backup_all.sqlThere should be no
errormessages in the output. -
Stop all MITIGATOR instances (first with Standby database, then with Primary):
docker-compose down
Update to v26.04
-
On all instances, write the version line to the
.envfile:VERSION=v26.04.XHere
Xis the target minor version. -
On all instances, download the current Compose file:
wget https://docs.mitigator.ru/master/dist/docker-compose.yml -O docker-compose.yml -
On all instances, update the contents of
docker-compose.failover.ymlanddocker-compose.worker.failover.ymlfiles, if they are used.If
docker-compose.failover.ymlordocker-compose.worker.failover.ymlare specified in theCOMPOSE_FILEvariable of the.envfile, update them:Remove from pgfailover section:
volumes: - failover:/trigger:rwRemove from postgres section:
volumes: - failover:/failover:rwRemove the volumes section at the end of the file:
volumes: failover:If
docker-compose.failover.ymlanddocker-compose.worker.failover.ymlfiles 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 -
On all instances, download new images:
docker-compose pull -
On the MITIGATOR instance where the database is in Primary status, delete the database:
docker volume rm mitigator_postgres -
On the MITIGATOR instance where the database is in Primary status, start Postgres:
docker-compose run -d --rm --name postgres_idle postgres idle -
On the MITIGATOR instance where the database is in Primary status, open Postgres logs:
docker logs -f postgres_idle -
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 messagesrole "repuser" does not exist. -
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' -
Stop the temporary Postgres container and start the main service:
docker stop postgres_idle && \ docker-compose up -d postgres && \ docker-compose logs -f postgres -
Wait for the message
database system is ready to accept connections, press Ctrl+C. -
On MITIGATOR instances where the database is in Standby status, delete the database:
docker volume rm mitigator_postgres -
On MITIGATOR instances where the database is in Standby status, perform database initialization:
docker-compose run --rm -e PGPORT=15432 postgres standby -
Start the MITIGATOR instance where the database is in Primary status:
docker-compose up -d -
After startup, wait for all migrations to complete and settings to propagate.
-
Start other MITIGATOR instances:
docker-compose up -d