Phase 7: scheduled (recurring) backups (0.7.0)

- BackupSchedule model + schedule_service: next-run calc (hourly/daily/weekly,
  UTC), background scheduler loop (lifespan), run-one with retention pruning
  (keep newest N per stack on the destination), backup_failed notify event.
- routers/schedules.py: schedules CRUD + run-now; registered in main.py.
- Frontend: api/schedules.ts + Settings → Scheduled backups (list with next/last
  run + status, enable/disable, run-now, delete; add form with stack/destination/
  frequency/time/weekday/retention/volumes).

Rough-verified only (per request): py_compile, frontend tsc build, app import
(95 routes), next-run math sanity. Full live run to be tested after deploy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
menzelj
2026-06-07 22:02:52 +00:00
co-authored by Claude Opus 4.8
parent 7bd449101d
commit 84ef3df59e
10 changed files with 697 additions and 5 deletions
+19 -1
View File
@@ -5,7 +5,7 @@ as intuitive as Dockge, as capable as Portainer for Compose workflows.
> **Status:** Phase 1 (Core) + Phase 2 (Volumes & GPU) + Phase 3 (Quality of
> Life) + Phase 4 (Operations) + Phase 5 (Multi-host) + Phase 6 (Backup
> destinations) complete.
> destinations) + Phase 7 (Scheduled backups) complete.
## What works today (Phase 1)
@@ -91,6 +91,16 @@ as intuitive as Dockge, as capable as Portainer for Compose workflows.
and restore (volumes included) directly from it. Remote backups can also be
deleted from the UI.
### Phase 7 — Scheduled backups
- **Recurring backups**: schedule a stack to back up to a destination **hourly,
daily, or weekly** (UTC) under **Settings → Scheduled backups**. A background
scheduler runs due jobs every minute and records last/next run + status.
- **Retention**: keep the newest *N* backups per stack on the destination; older
ones are pruned automatically.
- **Run now** for an on-demand run, plus a `backup_failed` notification event
wired into the webhook system.
## Deploying an agent on another host
```bash
@@ -227,6 +237,14 @@ DELETE /api/backups/destinations/{id}/backups/{name}
POST /api/stacks/{id}/backup/push POST /api/stacks/restore-from
```
### Phase 7 endpoints
```
GET /api/backups/schedules POST /api/backups/schedules
PUT /api/backups/schedules/{id} DELETE /api/backups/schedules/{id}
POST /api/backups/schedules/{id}/run
```
## Security notes
- The Docker socket is only ever touched by the backend process; it is never