Backup and restore

Postgres

These commands use the postgres17 container. If postgresHost in your gamebench.toml is still set to postgres, use the postgres container instead until you’ve completed the Postgres 17 migration.

Dump database

docker exec -ti postgres17 pg_dump -Fc -U postgres elm-integration -f /tmp/gamebench-postgres-backup-$(date +"%Y-%m-%d_%H-%M-%S").dump

Copy the backup out of the container. The file is lost if it’s left in the container and the container is recreated.

docker cp postgres17:/tmp/<backup postgres filename> .

Restore database from backup

Please note the database will be dropped before being restored, ensure the backup is taken first and the file was successfully written.

docker cp <backup postgres filename> postgres17:/tmp/
docker exec -ti postgres17 psql -U postgres -c 'DROP DATABASE "elm-integration"'
docker exec -t postgres17 pg_restore -C -d postgres -U postgres /tmp/<backup postgres filename>

Data

If you’ve bind-mounted your data directory, you can skip this step and use the bind mount destination.

Find volume mountpoint

docker volume inspect -f '{{.Mountpoint}}' $(docker volume ls | grep filedata | awk '{ print $2 }')

Archive data

sudo tar -C <volume mountpoint> -czf gamebench-data-backup-$(date +"%Y-%m-%d_%H-%M-%S").tar.gz .

Restore data

sudo tar -C <volume mountpoint> -xzf <data backup filename>
Last updated on