Volumes
Keep data around between deployments.
A service's filesystem is thrown away on every deployment. Anything your app writes to disk and needs later belongs on a volume: uploads, SQLite files, caches you want to keep.
Databases you create through Unbind manage their own storage. You do not add volumes to them.
Create a volume
Open the command panel and pick Volume. Choose the service to mount it on, then the path where it should appear inside the service. The default is /data.
Press Deploy on the changes bar. The volume is created and the service restarts with it mounted.
- One volume per service. A service that already has a volume shows up in the list, but can't be picked. Unmount its volume first.
- One replica per service with a volume. See Replicas.
- The path has to match your app. If your app writes uploads to
/app/uploads, mount the volume there.
Size
A new volume starts small. Open it to see Usage: how much is used out of the total. Unbind warns you at 75% and again at 85%.
Where the volume lives sets the smallest size you can pick. On the server's disk it is a fraction of a gigabyte. On cloud volumes it is the provider's minimum, 10 GB on Hetzner Cloud and 1 GB on DigitalOcean, and the provider bills every volume by the gigabyte. Whoever installed Unbind made that choice; see Install.
To grow it, use Expand, pick the new size and confirm. It takes a couple of minutes and the data stays in place.
Volumes only grow
A volume cannot be made smaller. Start small and expand when you need to.
Replicas
Replicas can't share a volume, so a service with a volume runs a single replica. Its Replicas setting is locked at 1.
A service that runs several replicas can't get a volume. It shows up in the list when you mount one, but can't be picked. Set its replicas to 1 and deploy first.
If you need several replicas, keep the state somewhere shared instead: a database, or S3 compatible storage.
Deployments
Two versions never write to a volume at the same time. During a deployment the old version stops before the new one starts, so expect a gap of a few seconds.
Unbind keeps that gap short in two ways. It pulls the new image while the old version is still running. And the old version gets about 2 seconds to stop after its stop signal (SIGTERM), not the 5 seconds other services get, so an app that needs longer to write its data out safely should not rely on that window. If the image can't be pulled, the deployment shows an error and the old version keeps running.
A new version that crashes on start still takes the service down, because the old version has already stopped. Health checks do not prevent this for a service with a volume.
A service without a volume gets the same rollout by setting Rollout to Stop first.
Permissions
A new volume is owned by root. Unbind mounts it with a group that your service runs with, so an image that runs as a non-root user can still create files in it. Files your app creates stay owned by the user it runs as.
If the image sets a run-as group in its security context, the volume uses that group instead.
Change the mount path
Open the volume and edit the Mount Path under Connection. Press Deploy on the changes bar and the service restarts with the volume at the new path. The data stays in place, only the path your app sees changes.
The reset button next to the field brings back the current path.
A database volume has no path to edit. The database mounts it where its engine expects.
Unmount
Open the volume and press Unmount next to the service under Mounted On, then press Deploy on the changes bar. The service restarts without the volume, and the data stays in the volume.
The volume shows as unmounting until the old version of the service stops. After that it waits in the environment, unmounted. Open it and pick a service under Mount to Service to mount it again, on the same service or another one.
A database volume cannot be unmounted. The database needs it to run.
Delete
- Deleting a service keeps its volume. The volume stays in the environment, unmounted, and can be mounted on another service. Open it and pick a service under Mount to Service, then set the Mount Path.
- Deleting an environment or a project deletes its volumes, with everything in them.
- A volume can be deleted only when it is not mounted. Unmount it first, then open it and use Delete Volume. This cannot be undone.
Backups
Volumes are not backed up by Unbind. Database backups cover databases only. If the files matter, copy them somewhere else on a schedule.