Volumes

Disks for VMs and folders for apps that outlive what uses them.

Overview

A volume is storage that outlives what uses it: a disk for a VM, or a folder apps and jobs keep across deploys and moves.

When to use it

  • A VM needs a disk.
  • An app writes files that must survive a new version.
  • Several jobs share files.

How it works

Filesystem volumes
Engine volumes mounted into apps and jobs, read-only if you ask.
Disk volumes
Thin qcow2 files created with qemu-img: a 50 GiB disk takes only what is written.

Every replica and both revisions during a rolling deploy mount the same filesystem volume. Disk volumes belong to one VM at a time.

Architecture

Volumes architectureFilesystem volumes mount into apps; disk volumes attach to VMs.mountattachApp replicasVMFilesystem volumemounted at a pathDisk volumeqcow2
Filesystem volumes mount into apps; disk volumes attach to VMs.
  • App replicas to Filesystem volume: mount
  • VM to Disk volume: attach

Flows

Keeping files across deploys

  1. Create a filesystem volume and mount it in the app at a path.
  2. A deploy starts the new revision with the same volume.
  3. Files written before are still there.

Set it up

In the console

  1. Open Volumes and choose New volume.
  2. Choose filesystem or disk, and the size for a disk.
  3. Attach it from the app, job or VM form.

With the CLI

enclave volume create media --type filesystem --wait

With OpenTofu

OpenTofu configuration
resource "enclave_volume" "media" {
  name = "media"
  type = "filesystem"
}

Settings reference

Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.

enclave_volume
NameTypeUseWhat it does
nametextrequiredName of the volume: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the volume.
typetextrequireddisk or filesystem. Changing it replaces the volume.
machinetextoptionalThe machine to run on (default: EnclaveStack chooses, and this reads back its choice). Changing it moves the resource, with its data, in place; apply waits for the move.
machine_labelsmap of textoptionalLabels the machine must have, when machine isn't set (key=value, all must match).
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
size_gibnumberoptionalA disk's size in GiB (default 10); it only grows, live. Filesystems have none.
snapshottextoptionalA snapshot of the same type to start from. Changing it replaces the volume.
attached_totextoutputWhat uses it, as comma-separated kind/name; refreshed by the server every minute or so.
idtextoutputResource ID.
used_bytesnumberoutputSpace a filesystem's files use (measured every few minutes).

Limits and security

Good to know

  • A disk volume belongs to one VM at a time.

Security

  • Volumes stay on the machine; take snapshots or backups for copies.