Storage Paths
Reference a provisioned volume's path with $storage.<name>.path — the same Launchfile resolves correctly under any provider.
What this demonstrates
- `storage` declares named volumes that are provisioned for you
- `$storage.<name>.path` resolves to the real path the volume was provisioned at
- It resolves to a real path wherever you deploy — the declared mount path under a container provider, a separate host directory in local dev — and your config never changes
- `persistent: false` marks ephemeral scratch space like caches
When to use this: Apps that need a storage path in their environment — without hardcoding a path that only works in one place.
storage-paths.yamlView on GitHub
# yaml-language-server: $schema=../schema/launchfile.schema.json
#
# Example: provider-resolved storage paths ($storage.<name>.path, D-39).
#
# An app declares the storage it needs (a named volume). The provider decides
# *where* that volume actually lives, then injects the resolved path back into
# the app's environment via $storage.<name>.path — so the app never has to
# hardcode a path that only one provider understands.
#
# The declared `storage.<name>.path` is the canonical/container path. The
# expression `$storage.<name>.path` is the path the running provider used:
# - container provider → the declared path (the bind-mount target), e.g. /data
# - native provider → a host directory, e.g.
# <project>/.launchfile/storage/<component>/<name>
#
# The same Launchfile is correct under both — the path leaves the command and
# the duplicated env default entirely. Unknown $storage.* resolves to "".
#
# See also: spec/SPEC.md § Storage Properties, spec/DESIGN.md D-39 (and D-36,
# which classifies a storage path as a provider-resolved "home #3" value).
version: launch/v1
name: notes-app
image: ghcr.io/example/notes-app:latest
provides:
- port: 8080
protocol: http
exposed: true
storage:
# A persistent data volume and an ephemeral cache.
data:
path: /var/lib/notes
persistent: true
cache:
path: /var/cache/notes
persistent: false
env:
# The app's data directory — resolved per provider, not hardcoded.
NOTES_DATA_DIR: $storage.data.path
# A path built from a storage path plus a suffix (use the braced form so the
# "/" cleanly terminates the reference).
NOTES_DB: "${storage.data.path}/notes.db"
# The cache directory — points at the ephemeral volume the provider made.
NOTES_CACHE_DIR: $storage.cache.path
health: /healthz
restart: alwaysKey lines explained
NOTES_DATA_DIR: $storage.data.path- Resolves to the provisioned path — /var/lib/notes under a container provider, a host directory in local dev. Never hardcoded.
persistent: false- Marks the cache volume as ephemeral scratch — not preserved across restarts like the data volume.
See this pattern in real apps — Mailpit and AnythingLLM use $storage.* to wire their data paths into the environment.