🐞 Bug: Project backups: back up and restore a project's files and volumes together
Problem
A full restore can't bring a project back consistently. The project's files are in the system backup, while its volumes are in separate volume backups taken at other times. After a restore, the compose files and the volume data can come from different points in time.
Export, import, transfer, and system, volume and project backups also each capture and restore state their own way, with their own schedule code.
Plan
Split backups into three kinds:
- System: Arcane itself only.
- Project: a project's files and volumes in one snapshot, restored together.
- Volume: a single volume, as today.
Schedules can be set globally on one Backups page or per project and volume.
All of them, plus export, import and transfer, run through one engine in internal/backup: one capture, Rustic or archive output, one restore, and one policy table for every schedule. Domains only describe what to back up and keep their own records and endpoints. Details and diagram: revised plan.
Tracking
Merge in order, all stacked (stack #4998):
- [x] #4876, #4879, #4887, #4888: prerequisites (merged)
- [x] #4995: project backups and restore
- [x] #4996: project schedules, per project or global, with one
backup_policiestable and service shared with volume schedules - [x] #4997: system backups without projects (breaking); staged restore swap
- [x] #4999: shared capture and restore in
internal/backup; export, import and transfer use it (same.arcane.tar.gzformat) - [x] #5000: volume backups use the shared capture and restore
- [x] #5001: system backups use the shared capture and restore
- [x] #5002 (final): global Volumes series and System schedules move into
backup_policies
All 7 are stacked in this order and ship together in one release. The last step completes the move to the shared engine.
Arcane Version
3.0.1
Installation Method
Docker Compose
Drafted with Claude Code (AI).
Phase 0 spike results, using rustic:v0.11.2 (the image Arcane uses):
- One snapshot can hold a project and its volumes. I mounted the project dir at
/snapshot/projectand each volume at/snapshot/volumes/<name>, all read-only, then ranbackup --as-path / /snapshot. Rustic followed the nested mounts. - Sharing the volumes repository dedups. I backed up a 2 MB volume the way volume backups do today, then took a project snapshot containing it. The project snapshot added 1,964 bytes.
- Restore has a catch.
restore SNAP:/volumes/<a> /targetbrings back the contents with their owners. It doesn't restore the target root's owner or mode: I got0:0 755where the original was999:999 700. Restoring the parentSNAP:/volumeswith the target volume mounted at/dest/<a>, and globbing out the other volumes, restores the root correctly. Project restore will do that. restore --deleteignores exclusion globs when deleting. A destination folder excluded with--glob '!/keepme'was still deleted. So system backups can't simply exclude projects: restoring/datawith--deletewould wipe the live/data/projects. Phase 5 needs a staged data restore, or project roots mounted read-only during the restore.
Phases 0–2 go in one PR, with the shared plumbing moved only now that project backups need it. Arcane avoids abstractions with no current user, so a refactor-only Phase 1 PR didn't make sense.
Drafted with Claude Code (AI).
Updated the direction and the tracking list above after settling how backups are organised:
- System backups cover Arcane itself only. Nothing else is backed up or labelled as System.
- Three global setups live on one Backups page: System, Projects and Volumes. The Projects section adds schedules that cover all or selected projects. The Volumes section is today's system-managed volume series, unchanged in behaviour but shown and labelled as Volume.
- Per-project and per-volume schedules stay on each item's own page and replace the global schedule for that item, the way per-volume schedules already override the system-managed series.
- Backup types read System, Project and Volume.
That replaces the earlier idea of a single centralized policy that would take over the system-managed volume series. Phase 4b (in progress) implements the above on top of #4898.
Drafted with Claude Code (AI).
Phase 5 decisions (system backups without projects):
- Always Arcane-only. From this release every new system backup leaves projects out, on existing and new installs alike, with no setting to keep them. The release notes will call this out as a breaking change so users set up project backups.
- Restore never touches project folders. A system backup without projects is restored into a staging folder inside the data folder, then Arcane's own files are swapped in with renames that never enter a project folder. Old backups that include projects restore exactly as today.
- Old version-1 backups that left projects out get the same staged restore. Today, restoring one after projects moved into the data folder deletes the live projects folder; this fixes that.
- Projects folder set to the data folder itself: system backups are refused, with a message explaining how to move projects into their own folder. The default
/app/data/projectsis simply left out. - After a system restore, project backups are matched back to the current projects, so backups still in use aren't treated as unmanaged and swept.
A short spike against Rustic v0.11.2 comes first: the exclusion globs, restoring into an empty staging folder with owners and modes intact, the swap leaving project folders untouched (same inodes), and failures mid-restore leaving live data intact.
Drafted with Claude Code (AI).
Thanks for working on this. The planned project backups and restores cover most of what I was looking for. Two details I would be particularly interested in are support for selecting and backing up bind mounts (in addition to Docker-managed named volumes), and the ability to restore or migrate a complete project to a different Docker host. That would make the feature especially useful for moving applications between servers and recovering from hardware failures.
Thanks for working on this. The planned project backups and restores cover most of what I was looking for. Two details I would be particularly interested in are support for selecting and backing up bind mounts (in addition to Docker-managed named volumes), and the ability to restore or migrate a complete project to a different Docker host. That would make the feature especially useful for moving applications between servers and recovering from hardware failures.
Bind mounts relative to the compose file are already backed up. Does this satisfy your requirement for bind mounts?
I thought I read in recent patch notes that the ability to migrate a project to a new host was also added. I'd have to double check to be sure.
[!NOTE] Superseded by the revised plan below.
Proposal: one backup pipeline for backups, restores, export/import and transfer
Right now project state is captured in four places: system/children/backup, volume/children/backup, project/children/transfer and project/children/bundle, about 11k lines of production code plus the partly shared internal/backup. Following the maintainer's suggestion to split capturing state from producing output, everything can become one pipeline with four parts: subject (what), capture (one path), sink (where it goes) and apply (one restore path).
Today, every feature captures project state in its own way:
flowchart LR
subgraph Today["Today: four ways to capture project state"]
T["project/children/transfer<br/>copyFiles + copyVolume<br/>(one volume at a time)"] --> TS["stream to the target environment"]
B["project/children/bundle<br/>PackProjectDirectory + volume tgz<br/>(each volume its own archive)"] --> BT[".arcane.tar.gz"]
V["volume/children/backup<br/>one volume per snapshot"] --> R1["Rustic: volumes repository"]
S["system/children/backup<br/>data dir + projects"] --> R2["Rustic: system repository"]
end
Proposed: one capture step, any output, one restore step:
flowchart LR
subgraph Subject["1. Subject: what"]
SY["System<br/>data dir + database"]
PR["Project<br/>dir + volumes + binds"]
VO["Volume"]
end
SY --> PL
PR --> PL
VO --> PL
PL["Plan<br/>parts + quiesce + manifest"] --> CA
subgraph Capture["2. Capture: one path"]
CA["Lock, quiesce, mount all parts<br/>read-only into one helper"] --> TR["/snapshot<br/>├ manifest.json<br/>└ parts/<name>/"]
end
subgraph Sink["3. Sink: where"]
TR --> RR["Repository<br/>Rustic: local or S3"]
TR --> AR["Archive<br/>tar stream"]
AR --> DL["Download (export)"]
AR --> PEER["Peer environment (transfer)"]
end
subgraph Apply["4. Apply: one path"]
RR --> SRC["Source → /restore tree"]
DL -. upload .-> SRC
PEER --> SRC
SRC --> AP["Check manifest, stop, stage,<br/>swap into place, fix owners, start"]
end
How to read it:
- Subject says what is backed up. Each domain turns its subject into a Plan: the parts to capture (project dir, each volume, each bind mount, or the data dir), how to quiesce them (stop containers, take a database snapshot), and a manifest describing them.
- Capture is the only code that touches live data. It takes the lock, quiesces, and mounts every part read-only into one helper container as a
/snapshottree. Everything is captured at the same moment. - Sink decides where that tree goes. Rustic backs it up into a repository (deduplication, encryption, S3). Archive tars the same tree into a file download or a stream to another environment.
- Apply is the only restore code. Every source unpacks into the same tree layout, then apply checks the manifest, stops the target, stages the files, swaps them into place, fixes owners and modes, and starts it again.
Each feature is then a combination of these parts:
| Feature | Subject | Sink / Source | Apply target |
|---|---|---|---|
| System backup / restore | System | Repository | In place (staged swap) |
| Project backup / restore | Project | Repository | In place, or as a new project |
| Volume backup / restore | Volume | Repository | In place, or into a new volume |
| Export / Import | Project | Archive → download / upload | New project |
| Transfer | Project | Archive → peer stream | New project on the peer |
| Scheduled + retention | any | Repository | — |
- One point in time. Project files, volumes and bind mounts are captured in a single stop-and-mount, which fixes the mismatch this issue describes.
- Rustic is first-class but optional. It's the Repository sink. Export and transfer never touch it.
- Transfer is export piped into import on the peer, so it needs no separate copy logic.
- Shared once instead of per feature: locking and waiting on overlapping runs, quiescing, the ownership fix for the volume root (Phase 0 finding 3), staged restore, rollback, progress reporting and retention.
Layout. One internal/backup domain with children/{capture,sink,restore,policies}, one Backup record and one API:
POST /backups {subject, sink}POST /backups/{id}/restore {target}GET /backups?subject=…
Project, volume and system only provide a subject resolver through Fx. pkg/rustic stays the Rustic CLI wrapper, and pkg/projects stays the archive reader/writer. The per-item tabs and the global Backups page are filtered views of the same list.
Out of scope: gitops backup. It's Git-based config sync and history (diffs, revisions, three-way merge on pull), not a capture of project state. It never touches volumes and doesn't need a point-in-time snapshot, so it stays separate. It only shares one thing with the pipeline: deciding which files belong to a project. That becomes one shared helper in pkg/projects, used by gitops, capture and the archive alike.
Migration path. Each step deletes more code than it adds:
internal/backupcore (capture, Repository sink, apply) with Project as the only subject. This is the #4894 + #4897 scope, rebased onto the core.- Archive sink. Export/import (#4888) and transfer move onto it, and their own packing and copy code is deleted. A reader for the old bundle layout stays so existing exports still import.
- Volume moves onto the core.
- System moves onto the core with the staged restore (#4907).
- Generic policies, which merges #4898 and #4901 into one.
Trade-off: the open stack (#4894–#4907) would be restructured instead of merged as it is. That's easiest to decide before #4894 lands the shared plumbing in its current shape. This is a design proposal based on the PRs and this thread; it hasn't been prototyped yet.
Drafted with Claude Code (AI).
To simplify reviews, the remaining PRs from my fork are closed. The work now continues as three stacked PRs on Arcane-owned branches: #4995, #4996 and #4997, merged in that order (view the stack).
Drafted with Claude Code (AI).
Revised plan: one backup engine for everything
This replaces the larger proposal above. At the end, every backup, restore, export, import and transfer goes through one engine.
flowchart LR
subgraph Domains["Domains: what to back up, their records and endpoints"]
P["project/children/backup"]
V["volume/children/backup"]
S["system/children/backup"]
end
subgraph Engine["internal/backup: one engine"]
PL["Plan"] --> CA["Capture<br/>/snapshot"]
CA --> RR["Rustic repository"]
CA --> AR["Archive<br/>export / transfer"]
RR --> AP["Restore<br/>stage, swap, rollback"]
AR --> AP
POL["Policies<br/>schedule, retention, sweep"] --> PL
end
P --> PL
V --> PL
S --> PL
Why: today export, transfer, and volume, system and project backups each capture and restore their own way, with separate schedule code too. One engine means one place for consistency (everything stopped and read at one point in time), locking, rollback and retention. Domains only describe what to back up and keep their own records and endpoints.
| # | PR | Change |
|---|---|---|
| 1 | #4995 | Project backup and restore: files and volumes in one snapshot. |
| 2 | #4996 | Project schedules, and one backup_policies table and service for volume and project schedules. Volume policies move in with their IDs, so their backups stay managed. |
| 3 | #4997 | System backups cover Arcane only; restore uses a staged swap. |
| 4 | #4999 | Capture and restore move into internal/backup. Export, import and transfer use them: the project stops once and is read in one pass. Same .arcane.tar.gz format, so old and new installs still exchange exports. Transfer streams that archive. |
| 5 | #5000 | Volume backup and restore use the shared capture and restore. |
| 6 | #5001 | System backup and restore use the shared capture and restore. |
| 7 | #5002 (final) | The global Volumes series and System schedules move into backup_policies, so every schedule uses one service. |
All 7 PRs are stacked in this order and ship together in one release. Step 7 is the last one; after it, every backup, restore, export, import, transfer and schedule uses the shared engine.
Drafted with Claude Code (AI).