Skip to main content

Volumes

Volumes give your container services storage. You declare them once at the top level of your manifest, then mount them into services by name. AppHaven creates each volume and manages where it lives.

services:
web:
type: container
build:
dockerfile: Dockerfile
volumes:
- name: uploads
mount_path: /app/uploads
- name: cache
mount_path: /app/cache

volumes:
uploads:
type: persistent # kept across deploys
cache:
type: ephemeral # scratch, safe to lose

Declaring volumes

Each entry under the top-level volumes is keyed by the volume name:

FieldTypeRequiredRules
typestringyesephemeral or persistent. No other values are accepted.
  • ephemeral: scratch storage for the deployment. Use it for caches and other data your app can rebuild.
  • persistent: durable storage that is kept across every redeploy. Use it for data that must survive releases.

A volume draws on the deployment's overall storage budget, shared with your managed database and backups; there is no per-volume size to set.

Mounting a volume

Each entry in a service's volumes list attaches one declared volume at a path inside the container:

FieldTypeRequiredRules
nameidentifieryesMust match a key in the top-level volumes map.
mount_pathstringyesThe path inside the container. Must be absolute and canonical: no .., no trailing /, no //, and no . segments.

You reference volumes by name only: where they live is AppHaven's concern.

Scoping and durability

Volumes are scoped to a deployment:

  • Redeploys keep your data. Persistent volumes survive every release of your app, and stopping a deployment keeps its data too; deploying again picks it right back up.
  • Backed up nightly. A deployment's persistent data is captured in a nightly snapshot; see Backups & recovery.
  • Previews are isolated. Production and each preview environment get their own volumes, so an experiment on a branch can never touch production data.
  • Managed databases bring their own storage. A managed database provisions its own persistent storage; you don't declare it here.

Where to go next