mirror of
https://codeberg.org/likwid/likwid.git
synced 2026-02-09 21:13:09 +00:00
- Backend: Rust/Axum with PostgreSQL, plugin architecture - Frontend: Astro with polished UI - Voting methods: Approval, Ranked Choice, Schulze, STAR, Quadratic - Features: Liquid delegation, transparent moderation, structured deliberation - Documentation: User and admin guides in /docs - Deployment: Docker/Podman compose files for production and demo - Demo: Seeded data with 3 communities, 13 users, 7 proposals License: AGPLv3
126 lines
2.7 KiB
Markdown
126 lines
2.7 KiB
Markdown
# Backup & Recovery
|
|
|
|
Protecting your Likwid data.
|
|
|
|
## What to Backup
|
|
|
|
| Component | Location | Priority |
|
|
|-----------|----------|----------|
|
|
| PostgreSQL database | Database server | Critical |
|
|
| Uploaded files | `/uploads` (if configured) | High |
|
|
| Configuration | `.env` files | High |
|
|
| SSL certificates | Reverse proxy | Medium |
|
|
|
|
## Database Backup
|
|
|
|
### Manual Backup
|
|
|
|
```bash
|
|
# Full backup
|
|
pg_dump -h localhost -U likwid -F c likwid_prod > backup_$(date +%Y%m%d).dump
|
|
|
|
# SQL format (readable)
|
|
pg_dump -h localhost -U likwid likwid_prod > backup_$(date +%Y%m%d).sql
|
|
```
|
|
|
|
### Automated Backup Script
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
# /etc/cron.daily/likwid-backup
|
|
|
|
BACKUP_DIR="/var/backups/likwid"
|
|
DATE=$(date +%Y%m%d_%H%M%S)
|
|
RETENTION_DAYS=30
|
|
|
|
# Create backup
|
|
pg_dump -h localhost -U likwid -F c likwid_prod > "$BACKUP_DIR/likwid_$DATE.dump"
|
|
|
|
# Compress
|
|
gzip "$BACKUP_DIR/likwid_$DATE.dump"
|
|
|
|
# Remove old backups
|
|
find "$BACKUP_DIR" -name "*.dump.gz" -mtime +$RETENTION_DAYS -delete
|
|
|
|
# Optional: sync to remote storage
|
|
# aws s3 cp "$BACKUP_DIR/likwid_$DATE.dump.gz" s3://bucket/backups/
|
|
```
|
|
|
|
### Containerized Backup
|
|
|
|
```bash
|
|
# If using podman-compose
|
|
podman exec likwid-prod-db pg_dump -U likwid likwid_prod > backup.sql
|
|
```
|
|
|
|
## Recovery
|
|
|
|
### Full Restore
|
|
|
|
```bash
|
|
# Drop and recreate database
|
|
psql -h localhost -U postgres -c "DROP DATABASE IF EXISTS likwid_prod;"
|
|
psql -h localhost -U postgres -c "CREATE DATABASE likwid_prod OWNER likwid;"
|
|
|
|
# Restore from dump
|
|
pg_restore -h localhost -U likwid -d likwid_prod backup.dump
|
|
|
|
# Or from SQL
|
|
psql -h localhost -U likwid likwid_prod < backup.sql
|
|
```
|
|
|
|
### Point-in-Time Recovery
|
|
|
|
For critical installations, configure PostgreSQL WAL archiving:
|
|
|
|
```ini
|
|
# postgresql.conf
|
|
archive_mode = on
|
|
archive_command = 'cp %p /var/lib/postgresql/archive/%f'
|
|
```
|
|
|
|
## Demo Instance Reset
|
|
|
|
The demo instance can be reset to initial state:
|
|
|
|
```bash
|
|
# Windows
|
|
.\scripts\demo-reset.ps1
|
|
|
|
# Linux
|
|
./scripts/demo-reset.sh
|
|
```
|
|
|
|
This removes all data and re-runs migrations with seed data.
|
|
|
|
## Disaster Recovery Plan
|
|
|
|
### Preparation
|
|
1. Document backup procedures
|
|
2. Test restores regularly (monthly)
|
|
3. Keep offsite backup copies
|
|
4. Document recovery steps
|
|
|
|
### Recovery Steps
|
|
1. Provision new server if needed
|
|
2. Install Likwid dependencies
|
|
3. Restore database from backup
|
|
4. Restore configuration files
|
|
5. Start services
|
|
6. Verify functionality
|
|
7. Update DNS if server changed
|
|
|
|
### Recovery Time Objective (RTO)
|
|
Target: 4 hours for full recovery
|
|
|
|
### Recovery Point Objective (RPO)
|
|
Target: 24 hours of data loss maximum (with daily backups)
|
|
|
|
## Testing Backups
|
|
|
|
Monthly backup test procedure:
|
|
1. Create test database
|
|
2. Restore backup to test database
|
|
3. Run verification queries
|
|
4. Document results
|
|
5. Delete test database
|