Actions
34 actions, callable from the panel, the command palette and the API as
POST /api/v1/a/<id>. Internal actions used between modules are not listed.
| Action | What it does | Risk | Preview |
|---|---|---|---|
backups.target.create | Create backup target | medium | |
backups.target.ensure_default | Default local backup target | low | |
backups.offsite.add | Keep a copy somewhere else | medium | |
backups.offsite.copy_now | Copy to other storage now | low | |
backups.target.delete | Delete backup target | high | |
backups.target.test | Test backup target (read) | low | No dry run |
backups.target.list | List backup targets (read) | low | No dry run |
backups.job.create | Create backup job | medium | |
backups.job.update | Update or pause a backup job | medium | |
backups.job.delete | Delete backup job | medium | |
backups.job.list | List backup jobs (read) | low | No dry run |
backups.job.run | Back up now | low | |
backups.run.list | List backup runs (read) | low | No dry run |
backups.status | Backup status of an account (read) | low | No dry run |
backups.snapshot.list | List snapshots (read) | low | No dry run |
backups.snapshot.browse | Browse a snapshot (read) | low | No dry run |
backups.snapshot.delete | Delete a snapshot | high | |
backups.database.snapshots | Points in time of a database (read) | low | No dry run |
backups.mailbox.snapshots | Points in time of a mailbox (read) | low | No dry run |
backups.restore.mailbox | Restore a mailbox | medium | |
backups.restore.files | Restore files | high | |
backups.restore.sources | Restore what another module added to the backup | high | |
backups.sources.list | List what other modules add to this account's backup (read) | low | No dry run |
backups.restore.database | Restore a database | high | |
backups.restore.site | Put a website back as it was | high | |
backups.restore.account | Restore a whole account | critical | |
backups.restore.rollback | Roll back a restore | high | |
backups.verify.run | Check a repository | low | |
backups.verify.test_restore | Test restore | low | |
backups.retention.preview | Preview retention (read) | low | No dry run |
backups.recovery.export | Export recovery bundle (read) | critical | No dry run |
backups.reconcile | Re-apply backups | low | |
backups.priority.check | Is Priority backups licensed (read) | low | No dry run |
backups.priority.limits | Backup limits and Priority backups (read) | low | No dry run |
Permissions and limits
Permissions
backups.viewView targets, jobs, snapshots and runsbackups.target.manageCreate and delete backup targetsbackups.job.manageCreate, change and delete backup jobsbackups.job.runRun a backup nowbackups.snapshot.manageDelete snapshotsbackups.restoreRestore files, databases and roll backbackups.restore.accountRestore a whole accountbackups.verifyCheck repositories and test restoresbackups.recoveryExport the recovery bundlebackups.reconcileRe-apply schedules and repositories
Plan limits
backups.jobsBackup jobsbackups.targetsBackup targetsbackups.storage_gbBackup storage on this serverbackups.retention_daysLongest daily retentionbackups.manual_runs_per_dayManual backups per day
Engineering notes
Generated from modules/backups/docs.md at build 38156245. These are the notes the engineers keep
next to the code: precise, technical, and honest about what is not done yet.
Model
- Target = one restic repository for one account (own random 40-char password in the vault,
target/<id>; ADR 0013 §7). Kinds:local(/var/lib/rc-backups/<account>/<id>, root 0700),connection(anystorageconnection through restic's rclone backend, path below the connection's base path) ands3(a private bucket + two keys created on the built-in store through the publicstorage.*actions: a backup key and a prune key, both in the vault). Creating a target installs restic, runsinitand fails cleanly (everything created is rolled back) when it cannot write/read. - Immutability (
immutable_daysons3): the bucket is created with S3 object lock (COMPLIANCE, default retention). Proven in the lab: a permanent delete of a snapshot object version with the target's own credentials isAccessDenied, the panel refuses to force-delete the bucket,accounts.deletedkeeps the bucket. Honest limit: SeaweedFS has no "write without delete" action, so a plain S3 DELETE (whatrestic forgetdoes) only adds a delete marker - the data stays recoverable until retention ends but restic no longer sees that snapshot. Prune cannot free space inside the window. Backup, check, snapshots, ls, stats use--no-lock; forget/prune must lock (restic refuses otherwise), so on a locked bucket a lock file may outlive the run (see follow-ups). - Job = scope (paths relative to the home, excludes as restic globs,
databases: export every database first) + schedule (interval>= 15 min,daily,weekly,monthly, account time zone, up to 5 min stable jitter) + retention (keep-last/hourly/ daily/weekly/monthly/yearly, default 7d/4w/3m, daily capped bybackups.retention_days) + targets (each gets every run, per-target result).backups.schedule.tick(every minute, system actor) advancesnext_runbefore running, so a slow run never repeats, runs at most 5 due jobs per tick, a 5 %restic checkper target weekly, a test restore monthly, and raisesbackups.staleafter 48 h without success (once a day). - Run (
backups.job.run, or the tick): per-target busy flag (one backup/restore/check per target, stale after 3 h) ->databases.db.exportinto<home>/rc-backup/db/<db>.sql.gz(a database that fails to export fails the run: no silent partial backups) ->restic backup <home> --one-file-system --exclude-cachesundernice 19 / ionice idle-> 3 attempts with backoff -> stats -> retention (forget + prune with the prune credential, only after success, only snapshots taggedrcof that account; pre-restore safety snapshots are taggedpre-restoreand never pruned). Limits:backups.manual_runs_per_day(per target-run),backups.storage_gb(local and built-in S3 targets; skipped run +backups.quota.exceeded, nothing deleted). - Restore:
restore.files(default into<home>/restore-<time>/with the snapshot's relative tree, ownership/mode/symlinks kept,--verify;inplaceover the originals;otherinto another account on the same server, re-owned),restore.database(replacewith a safety dump first,newdatabase,downloadthe dump),restore.account(plan via dry run, typed account name, safety snapshot first, files in place then every database import, rollback within 24 h viarestore.rollback). All dry-runnable. verify.run(restic check, optional subset),verify.test_restore(random 5 files into a scratch dir, hash verify, cleanup),retention.preview(forget --dry-run),recovery.export(admin, critical: repository locations + passwords + S3 keys; audited).
Priority backups (add-on priority-backups, $5 per server per month)
Scheduled backups to your own storage are free in every edition. The add-on lifts three limits, all enforced in
backups.job.create / backups.job.update, so the API, CLI, assistant, webhooks and screens meet the same refusal
(not_entitled, naming the add-on). The licence is asked through backups.priority.check (edition: priority-backups);
backups.priority.limits returns the limits and whether the add-on is on.
| Free | Priority backups | |
|---|---|---|
Shortest repeat (interval) |
every 6 hours (360 min) | every hour; every 15 min when the job backs up only databases |
| Retention | last 10, hourly 24, daily 7, weekly 4, monthly 6, yearly 0 | last 100, hourly 72, daily 30, weekly 12, monthly 24, yearly 5 |
Restore jobs (backups.restore.*) |
normal queue | dedicated lane in internal/jobs: start before waiting routine jobs and may use 2 places above the 20-job cap |
Daily, weekly and monthly schedules are never limited. Before this card an interval could be 15 minutes and retention up to 3650 for everyone: jobs that exist already keep what they have (a save never asks for more than the job already had), only new asks beyond the free limits need the add-on.
- When the add-on ends: the scheduler tick clamps every job that was raised above the free limits (interval to 6 h,
retention to the free numbers), keeps the old settings in
jobs.priority_saved, raisesbackups.priority.lapsed(bell) and pauses pruning for 30 days (retention_hold_until), so no existing snapshot is deleted on the spot. When the add-on comes back the old settings return (backups.priority.restored). - Jobs made before the limits existed are not flagged (
jobs.over_free), so they are never clamped.
Backup sources (contract, w11-62)
A module that keeps data of an account outside its home adds it to the account's backup by PROVIDING three actions
(declared in its module.yaml, permissions of its own) - there is no registration call, the backups module lists its
providers (sourceProviders in cp/sources.go) and declares exactly these three per provider in system_calls
(a scheduled run is the system, ADR 0018), so a module cannot add itself and cannot be asked for anything else:
<module>.backup.sources {account_id}->{sources: [{id, title, bytes (estimate), consistency: "quiesced" | "crash-consistent", note}]}. Read only. Empty = nothing to add.<module>.backup.stage {account_id}->{staged: [{stack|id, consistency, bytes, note}]}. Copies the sources into<home>/rc-backup/<module>/...as the account's files (run by the provider's agent op, never through a path the account could swap for a symlink), quiescing where the source declares how (stop, copy, resume - resume also on failure).<module>.backup.unstage {account_id, path?}removes the copies (after the run, and the restore folder after a restore). Rules: the provider resolves the account itself fromaccount_idwith its normal account check (a user can name only their own account, a reseller a customer's, a Team member none) and reads only that account's rows; the backups module passes the target's account and never anything the caller typed.sourcesthat fail with not found / forbidden / precondition (module absent, plan without it, no runtime) are skipped; any other error fails the run (no silent partial backup). A staged copy travels in the files backup of a whole-account job (paths: ["."], not databases-only); a job withscope.no_sources: trueleaves them out (the schedule form shows a switch "Include the data of your container stacks" and says what a whole-account backup holds). The run's note says which sources were copied crash-consistent. The Restore tab has a "Containers" kind that callsbackups.restore.sources. Restore:backups.restore.sources {target_id, snapshot, stack, into?, confirm?, secrets?}fetches the staged copy from the snapshot intorestore-<time>/in the home, calls<module>.backup.restore, removes the folder. Container stacks (providercontainers): the stack's named volumes, one<volume>.tar.gzeach +stack.json(compose, non-secret variables, the NAMES of secret variables, app id). A stack is quiesced (stopped for the copy, started again only if it was running) when it declaresRC_BACKUP_QUIESCE=stop(compose stacks) or is a catalog app withbackup.volumes; otherwise it is copied while running and said so (a database in it recovers as after a power cut). Restore creates a NEW stack (default<stack>-restored) fromstack.json; secret values are never in a backup, so they are given again (secrets). Into an EXISTING running stack only when its name is typed asconfirm. Extraction is confined to the new volume (os.Root: no.., no symlink out, no hard link out), ownership limited to the dockremap range, setuid/setgid dropped. Costs: the staged copy occupies the home's disk (and its quota) during the run.
Verified in the lab (2026-10-09)
Connect external S3 (fake cloud) -> init repo through rclone -> job with files + MariaDB -> run twice (second run added 4.7 kB of 3 MB)
-> delete files and drop a table -> alternate-folder restore (sha256 equal, mode 640 kept), in-place restore, database replace (row
data back) -> whole-account restore after deleting www/report.bin and dropping a table, then rollback -> verify 100 %, test
restore, retention keep-last 2 removed 2 of 4 snapshots on local and S3 targets -> immutable target proof -> restore into a second
account -> scheduler ran the due job -> account deletion removed targets, jobs, local repo, keys and connection config.
Known gaps / next (see handover)
Agent op timeout is 60 s (module SDK cannot set it) so big backups will fail until Host.Agent takes a timeout; no progress/cancel;
mail and containers volumes, PITR, server-level repo + DR restore, tar.zst archive download, mailbox restore, domain remap, cron
expressions, restoring deletes nothing that is not in the snapshot (a rollback does not remove files the restore added),
PostgreSQL "replace" needs a clean import (databases.db.import does not drop existing tables), restic/rclone from the distro
(0.16.4 / 1.60.1), per-snapshot delete.
Jobs in a project, retention per job, backup folder (fix/backups-retention-projects)
- Every snapshot a job makes carries the tag
job-<job id>. Retention (restic forget) is given that tag, so a job's rules only ever look at its own snapshots, however many jobs share the account's repository. Snapshots made before this change have no job tag and are never thinned out (the retention preview counts them). backups.retention.previewanswers in plain words: a summary, and for the job the backups that would be removed and the ones that stay, each with its date.- A job filed in a project (not a whole-home job) also carries the project's databases (their fresh dumps, by file,
never the stale dumps of other jobs) and the project's container stacks (staged one by one with
containers.backup.stage, removed after the run). The job's run preview names them. A failed lookup of the project stops the run; a panel without projects, or a job in none, adds nothing. backups.target.createtakeslocal_root(administrators): the repository goes to<local_root>/<account>/<id>instead of/var/lib/rc-backups. The folder must exist; the agent refuses system folders and links, and a local backup stops with a plain message when the disk has less than 2 GB free (checked at creation and before each run).
Back up every night (ease-walk, 2026-10-28)
The Overview offers one button while the account has no schedule: backups.target.ensure_default when it has no
target, then a previewed backups.job.create named "Every night" (daily 02:00, whole home, databases and mailboxes,
retention 7 daily, 4 weekly, 6 monthly). A new schedule in the Schedules tab starts with the same name and the only
target chosen. Restore preselects the only target that holds backups.
Keep a copy somewhere else (2026-10-28): after the first backup, the Overview offers
backups.offsite.add {connection_id}. One previewed plan makes a backup target on the storage connection (or connects new storage with the Storage form first) and adds it to every enabled schedule that has room (a schedule holds at most 5 targets).Put a website back (2026-10-28): Restore "A website" runs
backups.restore.site {target_id, site_id, snapshot, mode}: the site's document root and every database filed in the site's project, all from the one snapshot, as a single plan.copy(default) lands the folder in restore-Copy now (2026-10-29): when a place on other storage exists but holds no backup yet, Overview offers "Copy now" (
backups.offsite.copy_now, previewed, a job with progress). It runs the nightly job's backup against those places only, the same code as the nightly run, and refuses with a plain sentence while a backup or restore is running on a place.