Why you need one
In v0.13, incremental deployment prepares application code in managed release directories. Those directories are not durable writable storage. Put databases, uploads, and other mutable files on a data volume instead of beside source code. Durable state belongs on a persistent volume. The usual convention is a volume nameddata mounted at /home/developer/data, exposed to the app as DATA_DIR:
$DATA_DIR and they stay put across deploys.
A persistent volume survives app redeploys, 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 manage volumes independently of a deploy. Run locally, stop the workspace before create/resize/remove, then start it to attach the updated drive set: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, an app release updates code while the database file remains on its separate disk.
Next steps
- Deploying with rig deploy — the v0.13 deployment workflow.
- Releases & Rollback — roll the environment back without touching volume data.
- Snapshots — checkpoint the root disk only; attached volumes need separate backups.