Backup and Restore
Database Backup
# Backup database
./docker/deploy.sh backup
Uses pg_dump under the hood for PostgreSQL database backup.
Volume Backup
# Backup data volume
docker run --rm -v sparknoteai_postgres_data:/data -v $(pwd):/backup alpine tar czf /backup/postgres-backup.tar.gz -C /data .
Database Restore
# Restore database
docker run --rm -v sparknoteai_postgres_data:/data -v $(pwd):/backup alpine tar xzf /backup/postgres-backup.tar.gz -C /data
Complete Backup Procedure
- Stop services:
./docker/deploy.sh stop - Backup data volumes
- (Optional) Backup configuration files
- Restart after completion:
./docker/deploy.sh start
Recommendations
- Set up regular automated backups (via cron scheduled tasks)
- Store backup files in a remote location (e.g., S3/OSS)
- Periodically test the restore process to ensure backups are valid