Add setup to backup database and schedule weekly checks to ensure backups are valid #171
Labels
No labels
Compat/Breaking
Component/Enclave-Builder
Component/Infrastructure
Deploy/BYOC
Deploy/Full-managed
Deploy/Self-hosted
Interface/API
Interface/CLI
Interface/Git
Interface/Web
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
public/platform#171
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Back up the platform database hourly to append-only S3 storage, retain recoverable backups for 14 days, and encrypt to all designated team PGP public keys before anything is uploaded. Preserve this issue's original requirement for weekly restore checks.
Related infrastructure tracking: #312. This offsite, client-encrypted backup plan does not depend on a migration to RDS; managed database backups can be complementary.
Proposed plan
Job execution and operations
Use the existing Docker + user-systemd deployment model: run a short-lived backup container on the database host, with no additional always-on server or Hermes dependency. These are proposed units, not an already-deployed job.
caution-db-backup.service:Type=oneshot, launching a pinned backup image oncaution-network. Connect to PostgreSQL using a dedicated, least-privilege backup account and a compatiblepg_dumpclient. Dump, compress, encrypt, upload to a unique immutable prefix, and report success only after the full backup and required metadata are uploaded. Set an explicitTimeoutStartSec; failure/timeout must stop the owned container, clean up staging and return a failing status.caution-db-backup.timer:OnCalendar=hourly,Persistent=true. Use the same service for scheduled and manual runs so systemd prevents overlapping instances. Persistent scheduling triggers a catch-up run after downtime, not one backup for every missed hour. Ensure user lingering is enabled for the designated service account so scheduling survives logout and starts at boot..env, mount the Docker socket inside the backup container, or give it recipient private keys. Protect any plaintext staging and keep secrets out of logs..serviceand.timerfiles (it currently installs services only). Enable backups explicitly after configuring the intended environment, bucket and recipients; do not auto-enable production backups in test/development setup.After implementation, configuration and installation, the operator interface should be:
A later Kubernetes migration can reuse the backup image in an hourly CronJob with equivalent overlap, timeout and monitoring controls; Kubernetes is not a prerequisite for this work.
Tool evaluation
Evaluate Duplicity, including its S3 backend and compatibility with the append-only permissions above. Its
--encrypt-keyoption can be repeated to encrypt to multiple public keys, e.g.--encrypt-key <fingerprint-A> --encrypt-key <fingerprint-B>.The originally suggested name was "ruplicity". The project with that name describes itself as a library for exploring Duplicity backups, not a backup/restore tool; Duplicity appears to be the intended candidate. Keep the implementation simple and verify the selected tool/version rather than assuming append-only backend compatibility.
Acceptance criteria
move to RDS, use RDS backups