Skip to content

Volume Management

Griffen Fargo edited this page Jun 30, 2026 · 2 revisions

Volume Management

strut provides dynamic volume management driven by volume.conf in each stack.

Commands

strut my-stack volumes status --env prod     # Show volume status
strut my-stack volumes init --env prod       # Initialize volumes
strut my-stack volumes config --env prod     # Show volume configuration

volume.conf

Define volumes in stacks/<stack>/volume.conf. The file is sourced as shell, so use variable assignments — not colon-delimited rows. The engine discovers any variable ending in _PATH / _DATA_PATH as a host path (plus the optional DATA_VOLUME_* shared device/mount) and reads ownership from a VOLUME_OWNERS mapping:

# Optional shared data device/mount
DATA_VOLUME_MOUNT=/mnt/data

# Per-volume host paths (any *_PATH / *_DATA_PATH variable is discovered)
POSTGRES_DATA_PATH=/mnt/data/postgres
UPLOADS_PATH=/mnt/data/uploads
REDIS_DATA_PATH=/mnt/data/redis

# Ownership: "VAR_NAME=uid:gid ..." (space-separated)
VOLUME_OWNERS="POSTGRES_DATA_PATH=999:999 UPLOADS_PATH=1000:1000 REDIS_DATA_PATH=999:999"

Volume Initialization

strut my-stack volumes init --env prod

Creates host directories, sets ownership, and ensures volumes are ready before deployment.

Reusing Existing Volumes

When migrating from an existing setup, reference existing Docker volumes:

# In docker-compose.yml
volumes:
  postgres-data:
    external: true
    name: existing_postgres_data

Stopping with Volume Cleanup

# Stop containers only
strut my-stack stop --env prod

# Stop and remove volumes (⚠️ data loss)
strut my-stack stop --env prod --volumes

Clone this wiki locally