Skip to content

feat(volumes): track volumes as daemon objects #335

Open

Description

@PiquelChips

Problem

Volumes are Docker local volumes found by their names. The database does not know them, except for the inventory previews keep. Deleting an environment leaves its volumes behind with no record: they cannot be listed, reattached or reclaimed except with docker volume. A volume's identity is its manifest name, so there is nowhere to put a restored copy beside the original.

Proposed solution

Volumes become objects. A volumes table records each volume's ID, Docker name, pool (local until #339), creation time, state (attached or detached) and, where it can be measured, its size. The preview inventory moves into it.

Environments bind names to volumes. An environment maps each manifest volume name to a volume ID; the name is no longer the volume. Restoring (#337) becomes "create a volume, rebind the name", and a replaced volume stays beside the new one.

/// What a manifest volume name of an environment points at.
struct VolumeBinding {
    environment: EnvironmentId,
    name: VolumeName,
    volume: VolumeId,
}

Adoption, no data move. The migration adopts every existing volume under its current Docker name. New volumes get Docker names derived from their ID.

Detached volumes. Deleting an environment detaches its volumes instead of forgetting them. A detached volume can be listed, attached to an environment under a name (replacing nothing: attaching to a bound name is refused), or deleted. Preview volumes are still deleted with their preview.

Surfaces

  • API: list, show, attach, delete.
  • CLI: piquelctl volume list [APP [ENV]] [--detached], volume show, volume attach APP ENV NAME VOLUME, volume delete.
  • Dashboard: an environment's volumes with their size and state, and a list of detached volumes.

Written with Claude Opus 5.5 in Claude Code (via T3 Code).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions