-
Notifications
You must be signed in to change notification settings - Fork 0
Updating & Migrating
To update OpenMTG to the latest version:
docker compose pull
docker compose upDocker compose pull fetches the latest ghcr.io/dredbaron/openmtg:latest image. The docker compose up -d restarts only containers whose image has changed. Database migrations run automatically when the app container starts. The app will not start until the db container passes its health check, so there is no risk of migrations running against an unavailable database.
You do not need to run any migration commands manually.
Two paths need to be backed up regularly. Both are defined in the .env:
- Database
DATA_PATH
cp -r ./data ./data.bak- App config
CONFIG_PATH
cp -r ./config ./config.bakUse pg_dump via the running db container for a clean, portable backup:
docker compose exec db pg_dump -U $POSTGRES_USER $POSTGRES_DB > backup.sqlThis produces a plain SQL dump in your current directory. Run this with the stack running, pg_dump is safe against live databases.
To create a compressed backup:
docker compose exec db pg_dump -U $POSTGRES_USER $POSTGRES_DB | gzip > backup.sql.gzNote: Restoring overwrites your current data. Make sure you have a backup before proceeding.
- Bring the stack down
docker compose down- Bring up only the database
docker compose up -d db- Wait for the container to become healthy, then run the restore
cat backup.sql | docker compose exec -T db psql -U $POSTGRES_USER $POSTGRES_DB- If your backup is compressed
gunzip -c backup.sql.gz | docker compose exec -T db psql -U $POSTGRES_USER $POSTGRES_DB- Bring the full stack back up
docker compose up -d- Back up both
DATA_PATHandCONFIG_PATHas described above. - Copy the
.envfile. This contains yourDB_PASSWORDandJWT_SECRETwhich must match the restored data. - On the new host, clone the repository, place your
.env, restore the database and config, then rundocker compose up -d
Note: Changing
JWT_SECRETafter a move will invalidate all active user sessions. Users will need to log back in, but no data is lost.