Backup & Restore
Protect your compliance data with regular backups and understand how to restore when needed.
Cloud Hosted Customers
If you're using Pestle's managed cloud service:
- Automatic daily backups - Retained for 30 days
- Point-in-time recovery - Restore to any point in the last 7 days
- Geographic redundancy - Backups stored in multiple regions
- Encryption at rest - AES-256 encryption for all backup data
Contact support@pestle.com to request a restore.
Self-Hosted Backup
Database Backup
Back up your PostgreSQL database regularly:
# Full database backup
pg_dump -h localhost -U pestle_user -d pestle_db > backup_$(date +%Y%m%d).sql
# Compressed backup
pg_dump -h localhost -U pestle_user -d pestle_db | gzip > backup_$(date +%Y%m%d).sql.gz
# With Docker
docker-compose exec db pg_dump -U pestle pestle > backup_$(date +%Y%m%d).sql Media Files Backup
Back up uploaded files (evidence, attachments):
# Copy media directory
cp -r /path/to/pestle/media /backup/media_$(date +%Y%m%d)
# Or with rsync for incremental backups
rsync -av /path/to/pestle/media/ /backup/media/ Configuration Backup
Don't forget your configuration:
# Back up environment and config files
cp .env /backup/config/
cp docker-compose.yml /backup/config/ Automated Backup Script
Example cron job for daily backups:
#!/bin/bash
# /opt/pestle/backup.sh
BACKUP_DIR="/backups/pestle"
DATE=$(date +%Y%m%d_%H%M%S)
# Create backup directory
mkdir -p $BACKUP_DIR/$DATE
# Database backup
docker-compose exec -T db pg_dump -U pestle pestle | gzip > $BACKUP_DIR/$DATE/database.sql.gz
# Media backup
tar -czf $BACKUP_DIR/$DATE/media.tar.gz /path/to/pestle/media
# Config backup
cp .env docker-compose.yml $BACKUP_DIR/$DATE/
# Remove backups older than 30 days
find $BACKUP_DIR -type d -mtime +30 -exec rm -rf {} +
echo "Backup completed: $BACKUP_DIR/$DATE" Add to crontab:
# Run daily at 2 AM
0 2 * * * /opt/pestle/backup.sh >> /var/log/pestle-backup.log 2>&1 Restore Procedures
Database Restore
# Stop the application
docker-compose stop backend
# Restore from backup
gunzip -c backup_20240115.sql.gz | docker-compose exec -T db psql -U pestle pestle
# Or without compression
docker-compose exec -T db psql -U pestle pestle < backup_20240115.sql
# Start the application
docker-compose start backend Media Files Restore
# Restore media directory
cp -r /backup/media_20240115/* /path/to/pestle/media/
# Or extract from tar
tar -xzf /backup/media.tar.gz -C /path/to/pestle/ Disaster Recovery
Full System Restore
- Provision new server with required dependencies
- Restore configuration files (.env, docker-compose.yml)
- Start database container
- Restore database from backup
- Restore media files
- Start application containers
- Run database migrations (if upgrading)
- Verify application functionality
Testing Backups
Regularly verify your backups work:
- Restore to a test environment monthly
- Verify data integrity
- Test application functionality
- Document restore time for RTO planning
Data Export
Export your data for external backup or migration:
- Settings → Export Data - Export all data as JSON/CSV
- API Export - Programmatic data export via API
- Individual Reports - Export specific assessments or registers
Retention Policy
Recommended backup retention:
- Daily backups - Keep for 7 days
- Weekly backups - Keep for 4 weeks
- Monthly backups - Keep for 12 months
- Annual backups - Keep for 7 years (compliance)