rig deploy rsyncs, anything you write there survives redeploys, restarts, and stop→start cycles.
Why you need one
rig deploy wipes and re-rsyncs the synced app directory on every deploy. That makes deploys clean and reproducible, but it means you must never store durable data inside the app dir — a redeploy would erase it.
Durable state belongs on a persistent volume. The usual convention is a volume named data mounted at /home/developer/data, exposed to the app as DATA_DIR:
$DATA_DIR and they stay put across deploys.
A persistent volume survives redeploys (the rsync wipe), app restarts, and stop→start of the workspace. It is destroyed only when you delete the volume or the workspace itself.
Declare a volume in rig.yaml
The canonical path is to declare durable disks once underworkspace.volumes, then opt each app into the mount with volumes: [data]. The volume is created or reattached on deploy, and only apps that reference it receive the mount.
DATA_DIR at the same path and your app reads and writes durable state there.
For multi-app projects, keep the declaration at the workspace level and attach it only to the apps that need it:
volumes: [data] or volumes: [{ name: data }]. App-local full specs are still supported for single-app or one-off cases:
Manage volumes with the CLI
You can also create and manage volumes imperatively, independent of a deploy:rig volume resize and rig volume rm take the volume id (from rig volume ls), not its name.--workspace:
The SQLite-under-$DATA_DIR pattern
The most common use is a SQLite database that outlives deploys. Two pieces make it work:- Set
DATA_DIR=/home/developer/datainenv:and put the database file under it. mkdir -p "$DATA_DIR"at startup — a fresh workspace may not have the directory yet.
notes.db lives on the volume, not in the synced app directory, a rig deploy rsyncs your new code over the app dir while the database file is left untouched.
Next steps
- Deploying with rig deploy — the full deploy workflow and the rsync model.
- Releases & Rollback — roll the environment back without touching volume data.
- Snapshots — capture the entire disk (including the volume) for checkpoint and recovery.