85 lines
1.6 KiB
Markdown
85 lines
1.6 KiB
Markdown
|
|
# Backup & Recovery
|
||
|
|
|
||
|
|
## Backup Strategy
|
||
|
|
|
||
|
|
| Data Type | Frequency | Retention |
|
||
|
|
|-----------|-----------|-----------|
|
||
|
|
| Database (full) | Daily | 30 days |
|
||
|
|
| Database (incremental) | Hourly | 7 days |
|
||
|
|
| Uploaded documents | Daily | 1 year |
|
||
|
|
| Configuration | On change | 90 days |
|
||
|
|
| Blockchain state | Daily | 90 days |
|
||
|
|
|
||
|
|
## Database Backup
|
||
|
|
|
||
|
|
### Automated Backups
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Daily full backup (runs at 02:00 UTC)
|
||
|
|
pg_dump -Fc tlas_prod > /backups/tlas_$(date +%Y%m%d).dump
|
||
|
|
|
||
|
|
# Hourly WAL archiving
|
||
|
|
archive_command = 'cp %p /backups/wal/%f'
|
||
|
|
```
|
||
|
|
|
||
|
|
### Manual Backup
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Create backup
|
||
|
|
docker exec postgres pg_dump -U tlas -Fc tlas_prod > backup.dump
|
||
|
|
|
||
|
|
# Verify backup
|
||
|
|
pg_restore --list backup.dump
|
||
|
|
```
|
||
|
|
|
||
|
|
## Recovery Procedures
|
||
|
|
|
||
|
|
### Database Recovery
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Stop application
|
||
|
|
docker-compose stop api
|
||
|
|
|
||
|
|
# Restore database
|
||
|
|
pg_restore -d tlas_prod -c backup.dump
|
||
|
|
|
||
|
|
# Verify data
|
||
|
|
psql -d tlas_prod -c "SELECT COUNT(*) FROM applications;"
|
||
|
|
|
||
|
|
# Restart application
|
||
|
|
docker-compose start api
|
||
|
|
```
|
||
|
|
|
||
|
|
### Point-in-Time Recovery
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Restore to specific timestamp
|
||
|
|
recovery_target_time = '2026-02-09 10:00:00'
|
||
|
|
```
|
||
|
|
|
||
|
|
## Disaster Recovery
|
||
|
|
|
||
|
|
### RTO/RPO Targets
|
||
|
|
|
||
|
|
| Metric | Target |
|
||
|
|
|--------|--------|
|
||
|
|
| Recovery Time Objective (RTO) | 4 hours |
|
||
|
|
| Recovery Point Objective (RPO) | 1 hour |
|
||
|
|
|
||
|
|
### DR Procedure
|
||
|
|
|
||
|
|
1. Identify failure scope
|
||
|
|
2. Activate DR environment
|
||
|
|
3. Restore from latest backup
|
||
|
|
4. Verify data integrity
|
||
|
|
5. Update DNS to DR site
|
||
|
|
6. Notify stakeholders
|
||
|
|
|
||
|
|
## Backup Verification
|
||
|
|
|
||
|
|
Monthly backup testing:
|
||
|
|
- Restore to test environment
|
||
|
|
- Run integrity checks
|
||
|
|
- Verify application functionality
|
||
|
|
- Document results
|