Persistent Volumes
By default, data written inside a container is lost when the container is replaced during a redeployment. Persistent volumes solve this by mounting a named Docker volume into the container at a path you specify. Data written to that path survives redeployments, rollbacks, and container restarts.
How it works
Section titled “How it works”When you add a volume to a service, Clank:
- Creates a named Docker volume on the server (e.g.,
clank-myproject-myservice-data). - Mounts it into the container at the path you specify (e.g.,
/dataor/var/lib/postgresql/data). - On redeployment, the new container mounts the same volume. Your data is still there.
Volumes are tied to the server. If you move a service to a different server, the volume on the old server is not automatically migrated.
Adding a volume
Section titled “Adding a volume”In the dashboard:
- Go to your service’s Settings tab.
- Under Persistent Volumes, click Add Volume.
- Enter the mount path — the directory inside the container where data should persist. This must match where your application writes its data.
- Save and redeploy.
The volume is created on first deploy and reused on subsequent deploys.
Common mount paths
Section titled “Common mount paths”| Application | Mount path |
|---|---|
| PostgreSQL | /var/lib/postgresql/data |
| MySQL | /var/lib/mysql |
| MongoDB | /data/db |
| Redis | /data |
| WordPress | /var/www/html |
| Generic app data | /data or /app/data |
Volume naming
Section titled “Volume naming”Volumes are named automatically: clank-{project-slug}-{service-slug}-data. This ensures volumes are unique per service and won’t conflict with other services on the same server.
Effect on deployments
Section titled “Effect on deployments”Volumes change how deployments work:
- No blue-green: Services with volumes always use recreate mode. Running two containers against the same database volume simultaneously would cause data corruption.
- Brief downtime: The old container stops before the new one starts. There is a short downtime window during the swap.
- Data persists: The new container sees the exact same data the old one wrote.
Deleting a service with volumes
Section titled “Deleting a service with volumes”When you delete a service, Clank asks whether to also delete its volumes. This is an opt-in step — volumes are preserved by default to prevent accidental data loss.
If you choose to delete volumes, the data is permanently removed from the server and cannot be recovered.
Limitations
Section titled “Limitations”- Server-local: Volumes exist on a single server. Moving a service to another server does not move its volumes.
- No cross-service sharing: Each volume belongs to one service. Two services cannot share a volume.
- No automatic backups: Clank does not automatically back up volume data. Use the backup feature or set up your own backup strategy for critical data.
Next steps
Section titled “Next steps”- Deployments — How volumes affect deployment strategy (recreate vs blue-green).
- Backups — Back up service data.