a9c7775bb7
Add backup/restore functionality for the SQLite database. Users can trigger manual backups, configure automatic backups on an interval with retention policies, list/download/delete backups, and restore from any backup. - Backup engine using VACUUM INTO (safe with WAL mode) - Backup metadata tracked in DB, files stored in DATA_DIR/backups/ - Settings: backup_enabled, backup_interval_hours, backup_retention_count - API: POST/GET/DELETE /api/backups, download, restore endpoints - Autobackup via cron scheduler with configurable interval - Retention: prune on startup, after each backup (manual and auto) - Orphan cleanup: removes backup files without metadata on startup - Restore: replaces DB and triggers graceful server shutdown - Settings UI: /settings/backup with toggle, interval, retention config - Backup list with download, delete, restore actions - i18n: English and Russian translations
27 lines
1021 B
Markdown
27 lines
1021 B
Markdown
# Feature Context: Backup Management
|
|
|
|
## Configuration
|
|
- **Development mode:** Automated
|
|
- **Execution mode:** Direct
|
|
- **Strategy:** Big Bang
|
|
- **Build (Go):** `go build ./cmd/server`
|
|
- **Build (Frontend):** `cd web && npm run build`
|
|
- **Check (Frontend):** `cd web && npm run check`
|
|
- **Dev server:** `./scripts/dev-server.sh` (port 8090)
|
|
|
|
## Current State
|
|
Starting fresh — no implementation yet.
|
|
|
|
## Key Architecture Decisions
|
|
- Backup via `VACUUM INTO` — creates a clean standalone DB copy, safe with WAL mode
|
|
- Backups stored in `DATA_DIR/backups/` as timestamped `.db` files
|
|
- Backup metadata tracked in a `backups` table in the main DB
|
|
- Autobackup uses existing robfig/cron scheduler pattern
|
|
- Restore replaces the DB file and triggers a graceful server restart
|
|
- ENCRYPTION_KEY is NOT backed up — user must have the same key on restore
|
|
|
|
## Cross-Phase Dependencies
|
|
- Phase 2 depends on Phase 1 (backup.Engine)
|
|
- Phase 3 depends on Phase 2 (API endpoints)
|
|
- Phase 4 depends on Phase 1 (Engine.Prune method)
|