Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 1.43 KB

File metadata and controls

40 lines (33 loc) · 1.43 KB

Database Recovery Guide

This document describes the steps to restore the production database using the existing backup tooling.

Prerequisites

  • Docker and Docker Compose installed
  • Access to the backups folder generated by PatronX
  • A working .env file inside infra/compose/ with database credentials
  • Optional AWS credentials configured if using S3 offloading

Recovery Steps

  1. Stop running services.
    make prod-down
  2. Identify the backup. List available backups using PatronX:
    make prod-list-backups
    Choose the appropriate backup file from the output (e.g. backups/2024-06-20.dump).
  3. 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-logs

Check 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.

Tips

  • 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.