Skip to content

[Issue]: Database backup and restore test #71

In progress

Description

@MariyaSamrout

Branch Name

feature/71-db-backup-restore

Task

Set up an automatic, regular and verifiable database backup, and prove that a backup can be restored.

Description
This issue merges #71 and #72.

The database holds donations, price grids, donor records and, later, issued tax receipts. Losing it, even partly, would mean losing financial records with tax value. A server failure, a bad migration or a mistaken deletion can happen at any time, so backups must be automatic and not depend on anyone remembering to run them. A backup is only useful if it is recent, complete and stored somewhere that survives the loss of the application server, in Canada. It contains personal data, so it must be handled securely. The retention period is to be confirmed with the client.

The daily backup runs as a scheduled Container Apps Job. Images are published on GitHub Container Registry and the repository is public, so the job image is public too: no key or credential goes in the image, they are passed through the job's secrets. The PRD also requires the Azure backups to be geo-redundant (copy in Canada East), which can only be set when the PostgreSQL server is created (#12).

A backup is only worth something if it restores. A file that exists is not proof that data can be recovered: it may be corrupted, encrypted with a key nobody can find, or restorable only through steps nobody wrote down. The restore test runs on a separate environment, never on production, and the result is checked: row counts must match the source, control queries must agree and the application must start against the restored database.

Scope

Backup

  • Backup script (full dump, compressed and encrypted)
  • Daily run with a scheduled Container Apps Job
  • Storage off the application server
  • Retention policy and automatic purge (to confirm)
  • Checksum and success/failure log, with an alert on failure
  • Geo-redundant Azure backups to Canada East, set at server creation ([Issue]: Azure resources and first manual deployment #12)

Restore

  • Restore script with checksum verification
  • Refusal to overwrite a non-empty database without explicit confirmation
  • Restore test on a separate test environment
  • Integrity check (row counts, control queries, application start)
  • Test with a corrupted file (must fail cleanly)
  • Step-by-step written procedure with the measured restore time

Acceptance Criteria

  • A backup is produced automatically every day
  • Old backups are purged according to retention
  • A failure is visible in the logs and triggers an alert
  • No credentials or keys are in the repository or in the job image
  • A real backup is restored successfully on a test environment
  • Row counts match the source
  • A corrupted file is detected and the target is left untouched
  • The restore script refuses to overwrite a non-empty database without confirmation
  • Backup and restore procedures are documented in the README, with the measured restore time

Checklist

  • I have checked for duplicate issues.
  • I have assigned the issue to the correct project board.
  • I have tagged the issue properly.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added this to the Sprint 3 milestone on Nov 14, 2026
  2. changed the title [-][Issue]: Database backup[/-] [+][Issue]: Database backup and restore test[/+] on Nov 27, 2026
  3. linked a pull request that will close this issueFeature/71 db backup restore #99on Dec 2, 2026
  4. reopened this on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions