Backups¶
Database¶
PostgreSQL is the primary data store. Regular backups are critical.
pg_dump (Logical Backup)¶
Restore:
Tip
Schedule pg_dump via cron or a Temporal scheduled workflow for automated daily backups. Compress and upload to S3 for offsite storage.
Continuous Archiving (WAL)¶
For point-in-time recovery, configure PostgreSQL WAL archiving:
- Set
wal_level = replicaandarchive_mode = oninpostgresql.conf. - Configure
archive_commandto copy WAL files to S3 or a backup volume. - Use
pg_basebackupfor the initial base backup. - Restore to any point in time using
recovery_target_time.
This is the recommended approach for production deployments where data loss must be minimized.
Media Files (S3/MinIO)¶
Uploaded media (product images, documents) is stored in S3-compatible object storage.
Replication¶
For production, use S3 cross-region replication or MinIO server-side replication to maintain copies in a secondary region.
Manual Backup¶
Or with MinIO client:
Redis¶
Redis stores sessions and cache. While losing Redis is not catastrophic (sessions expire, cache rebuilds), you may want to persist session data:
- RDB snapshots — periodic point-in-time snapshots (default Redis behavior).
- AOF — append-only file for crash recovery with minimal data loss.
Note
If Redis is lost, users will need to re-authenticate (session data gone) and the price cache will rebuild on the next request. No permanent data is lost.
Temporal¶
Temporal stores workflow execution history in its own database (typically a separate PostgreSQL instance). Back up the Temporal database using the same pg_dump strategy.
Temporal data is required to resume in-progress workflows after a restore. Without it, running workflows are lost and must be manually re-triggered.
Meilisearch¶
Search indexes can be rebuilt from the primary database at any time:
Backing up Meilisearch data is optional since it can always be regenerated. However, for faster recovery, Meilisearch supports snapshot exports:
Backup Schedule Recommendations¶
| Data | Frequency | Retention | Method |
|---|---|---|---|
| PostgreSQL | Daily full + continuous WAL | 30 days | pg_dump + WAL archiving |
| Media (S3) | Continuous replication | Indefinite | S3 cross-region replication |
| Redis | Optional — rebuilds automatically | N/A | RDB snapshots |
| Temporal DB | Daily | 14 days | pg_dump |
| Meilisearch | Optional — rebuilds from DB | N/A | Reindex on recovery |
Disaster Recovery¶
- Provision infrastructure — new database, Redis, S3.
- Restore PostgreSQL from latest backup.
- Restore media from S3 replica.
- Run Alembic —
alembic upgrade head(idempotent, ensures schema is current). - Reindex Meilisearch — rebuild search indexes from DB.
- Start services — API, workers, consumers, frontends.
- Verify — check
{ health }query, test a login, browse products.