This document describes the steps to restore the production database using the existing backup tooling.
- Docker and Docker Compose installed
- Access to the backups folder generated by PatronX
- A working
.envfile insideinfra/compose/with database credentials - Optional AWS credentials configured if using S3 offloading
- Stop running services.
make prod-down
- Identify the backup. List available backups using PatronX:
Choose the appropriate backup file from the output (e.g.
make prod-list-backups
backups/2024-06-20.dump). - Restore the database. Provide the selected backup file via the make task:
make prod-restore-db FILE=backups/2024-06-20.dump
Internally this calls infra/compose/scripts/restore_db.sh which runs a temporary PatronX container to perform the restore.
4. Verify the restore. Confirm the application starts and migrations apply correctly:
make prod-up
make prod-logsCheck the logs for any migration errors or failures. 5. Validate data. Perform smoke tests on critical flows (e.g. login, listing surveys) to ensure data integrity.
- Always restore to a staging environment first if possible.
- Keep the backup files secure and with restricted permissions.
- Document the incident, including the backup used and verification steps taken.