-
Notifications
You must be signed in to change notification settings - Fork 24
Upgrade Docker images
Thomas Piller edited this page Sep 22, 2023
·
7 revisions
⚠ Commands below expect a MapX stack running with docker compose.
-
Shutdown services
# Stop all services to avoid write on pg docker compose down # Optionally, set 'maintenance mode' on app ( env file ) and restart it # docker compose up -d app
-
Export dump
# Start pg service and wait for the service to be listening ~ 1 min docker compose up -d pg # Dump PostgreSQL entire cluster ( -c = clean db instruction, used at re-import time ) docker compose exec pg pg_dumpall -U postgres -c | gzip > {filename}.gz # Alternative with uncompressed output # docker compose exec pg pg_dumpall -U postgres -c > {filename}.sql # Shut down pg docker compose stop pg
-
Move the
postgres
data folderThe
postgres
data folder must be empty when the volume is imported in the new container. That folder could be moved or simply removed.# Move / backup the postgres data folder. # Using volume and a base image. Shared volume name depend on your config: `docker volume list`. docker run --rm -v {your shared volume name}:/shared alpine:3.12 mv /shared/postgres /shared/postgres_orig # Alternatively, using a folder. With a shared folder named "_shared", just do : # mv _shared/postgres _shared/postgres_orig
-
Update Docker image in the file
docker-compose.yml
... pg: image: postgis/postgis:14-3.1-alpine ...
-
Restart
pg
service and re-import dump# Instantiate pg & wait for the db to be ready ~1 min docker compose up -d pg # Import archive file (-T = no TTY) gunzip < {filename}.gz | docker compose exec -T pg psql -U postgres -d mapx # Import uncompressed sql file # cat {filename}.sql | docker compose exec -T pg psql -U postgres -d mapx
-
Restart all services
docker compose up
When You encounter errors due to PostGIS upgrade:
ERROR: could not get commit timestamp data
HINT: Make sure the configuration parameter "track_commit_timestamp" is set.
Run:
docker compose exec pg psql -U postgres
> ALTER SYSTEM SET track_commit_timestamp = 'on';
> \q
docker compose restart
Anything unclear or inaccurate? Please let us know at info@mapx.org