Skip to content
Install

Attach storage to an app

A container’s filesystem is deleted when the pod restarts, so an app that writes uploads, a SQLite file, or a cache to disk loses them on every deploy. Attach a volume to keep those files. Orchard creates a PersistentVolumeClaim from the cluster’s storage class and mounts it at the path you choose.

  1. Open the app.
  2. Go to Settings > Storage.
  3. In Volumes, select Add volume.
  4. In Name, enter a name for the volume.
  5. In Mount path, enter the path inside the container, such as /data.
  6. In Size, enter the size, such as 1Gi.
  7. (Optional) Turn on Read-only.
  8. Select Save. Saving restarts the app.

You can also add a volume when you create an app, under Advanced > Storage.

From a shell in the container, list the mount path. An empty ext4 volume contains a lost+found directory. If the path is not mounted, its contents are ordinary container storage and are deleted with the pod.

  • Most storage classes allow one writer at a time. If you scale past one replica on one of these classes, the extra pods do not start.
  • With a volume, updates stop the app first.
  • Volumes can grow, but they cannot shrink. Growth needs a storage class that allows expansion.
  • Orchard does not back up app volumes. To keep data safe, write it to object storage or a managed database. Managed databases have their own storage and do not need a volume.

Orchard records a volume as soon as you add it. A volume you add during a build reaches the pod that build creates. Each rebuild also compares the running pod with the configured volumes and repairs any difference.