Share

Database restore

Warning:

Local installations of Flow Production Tracking are no longer offered. This documentation is intended only for those with existing instances of Flow Production Tracking Enterprise Docker. Click here for a list of our current offerings.

Note:

This articles explains how to restore a Flow Production Tracking database backup.

This is intended for Flow Production Tracking System Administrators.

Site backup restore

This is usually done when you need to restore the previous snapshot of the database, in the case that an upgrade has failed and left the previous database in an unusable state. It can also be used to restore production backup into staging site.

To restore the previous snapshot, first stop ALL the flow production tracking-app containers and email notifier, on ALL HOSTS.

 docker-compose stop app emailnotifier 

Change the flow production tracking-app image version in docker-compose.yml to match the version of the backup.

 vi /opt/flow production tracking/se/staging/docker-compose.yml 

Then run the commands below to restore by specifying the backup name, this will drop and recreate the ${PGDATABASE} database.

docker-compose run --rm dbops bash  
dropdb --if-exists ${PGDATABASE}  
createdb ${PGDATABASE}  
pg_restore --schema=public --no-owner --verbose --jobs 4 --dbname ${PGDATABASE} <BACKUP_NAME>  
psql --command 'set vacuum_cost_delay=10; ANALYZE;' 

Restart ALL the flow production tracking-app containers and email notifier, on ALL HOSTS.

docker-compose up -d app emailnotifier 

Restore legacy backup file

Backups for Flow Production Tracking were previously taken in a tar binary format. To restore backups in that format:

docker-compose run --rm dbops dropdb flow production tracking  
docker-compose run --rm dbops createdb flow production tracking  
zcat db_dump.sql.gz | docker-compose run --rm dbops psql --single-transaction 

References

For more information about pg_restore, see https://www.postgresql.org/docs/12/app-pgrestore.html.

Was this information helpful?