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.
Attach a volume
Section titled “Attach a volume”- Open the app.
- Go to Settings > Storage.
- In Volumes, select Add volume.
- In Name, enter a name for the volume.
- In Mount path, enter the path inside the container, such as
/data. - In Size, enter the size, such as
1Gi. - (Optional) Turn on Read-only.
- Select Save. Saving restarts the app.
You can also add a volume when you create an app, under Advanced > Storage.
orchard deploy volumes set <id> --volume /data=1GiThis command replaces all the app’s volumes with the ones you pass. To remove every volume, omit --volume.
Verify the mount
Section titled “Verify the mount”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.
Limitations
Section titled “Limitations”- 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.
How volumes interact with builds
Section titled “How volumes interact with builds”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.
Related resources
Section titled “Related resources”- Scale an app and set resources - Change replicas, CPU, and memory.
- Grow database storage - Increase the volume size of a managed database.