A volume keeps a process’s files, such as a database’s, across restarts and deploys. Every volume is backed up every day.
How volumes work
- A volume belongs to one process of one app, at a mount path such as
/data. A process can have one volume. - That process then runs exactly one instance. It can’t scale out.
- Each deploy stops the process, then starts the new release on the same volume: a few seconds when it doesn’t answer.
- The release command runs without the volume. See Deploys and releases.
- A process with a volume can sleep, like any web process.
- A volume’s top directory belongs to
root. If your image runs as another user, set the ownership when it starts. The official database images do this already.
Creating a volume
- Open your app’s Volumes page, and choose Create volume.
- Enter a Name: lowercase letters, digits and hyphens.
- Choose the Size, up to 50 GB.
- Choose the Process, or None: leave it detached.
- Enter the Mount path: where the process sees it. System paths aren’t allowed.
- Read Before you create it, then choose Create volume. The button shows its monthly price.
The process restarts to attach the volume.
What a volume costs
A volume costs $0.15 per GB a month, for the size you choose, billed by the second while it exists. That includes while the app is stopped, sleeping or suspended.
Your organisation’s volumes together can’t go over your limit. See Limits.
Growing a volume
A volume can grow, never shrink.
- Open the volume from Volumes.
- Set the new size.
- Choose Grow and restart the process now, or Grow at the next start.
The new size applies when the process next starts.
Backups
- Daily: every volume is backed up once a day, while it’s in use. The first backup runs within minutes of a new volume being ready.
- Kept for 7 days each.
- Where: off-site, in the EU, encrypted.
- On demand: Back up now takes one more. You can take a few a day; the page shows how many are left today.
Your organisation’s first 10 GB of backups are free, then they cost $0.08 per GB a month. A backup GB is what’s actually stored: unchanged data isn’t stored twice, and it’s compressed.
Dump your database too
For example, as a command in the Console, or a worker process’s command:
sh -c 'pg_dump "$DATABASE_URL" --format=custom --file=/tmp/app.dump'
Commands run without a shell, so sh -c is what expands $DATABASE_URL.
Then copy the file to storage of your own. mysqldump and mongodump do the same for MySQL and MongoDB.
Restoring a backup
A backup becomes a new volume, so the current one keeps running while it restores.
- Open the volume, and find the backup under Backups.
- Choose Restore….
- Enter the New volume’s name, and choose Restore to a new volume.
- When it’s ready, choose Attach in place of the old volume, or Keep it detached.
Attaching stops the process, swaps the volumes, and starts it on the restored data. Anything written after the backup was taken is only on the old volume, which stays detached, and billed, until you delete it.
Deleting a volume
- Open the volume, and choose Delete volume.
- Type its name to confirm.
- Choose whether to tick Also delete its backups. It’s off by default.
If the volume is attached, its process restarts without it.
Backups you keep are listed under Backups of deleted volumes, in the sidebar, until each is 7 days old. They’re still billed. From there you can restore one into a new volume in any of your apps, or Delete now.
Deleting an app deletes its volumes too, with the same choice about their backups.
If our infrastructure fails
When that happens, we email you the time of the backup your data now comes from. That process is down until the restore finishes; the rest of your app keeps running.
If that part of our infrastructure is only cut off for a while, your volume comes back as it was, with nothing lost.
For planned maintenance, we move your volume for you: the process stops, a final backup is taken, and it’s restored elsewhere. Nothing is lost, and your app is down while that runs. We email you before and after.
This is why you should keep your own database dumps, and why a process with a volume can be down when a process with several instances isn’t. See Availability.