Create a missing volume host directory before starting an app container #235

Closed
opened 2026-09-29 11:09:18 +02:00 by clawbot · 2 comments
Collaborator

sneak ruled on 2026-09-29 that an app's operator never pre-creates or chowns a host directory for the app's data, and no README tells him to (filed for pixa as sneak/pixa#159). The container sets its data directory's permissions itself.

That covers ownership, but not existence. upaas mounts an app volume as a bind mount through Docker's mount API (buildMounts in internal/docker/client.go, mount.TypeBind), and Docker refuses a bind mount whose host path does not exist. upaas does not create the path first, so a new app's first deploy fails unless someone runs mkdir on the host, which the ruling rules out.

Definition of done

  • Before creating an app's container, upaas creates each of the app's volume host paths that does not exist yet (os.MkdirAll, mode 0755, owned by root; the container fixes ownership itself). An existing path is left alone.
  • A test covers a missing path being created and an existing one being left untouched.
  • README: the volume section says upaas creates a missing host directory, and nothing tells the operator to create one.

Model: opus-5-5

sneak ruled on 2026-09-29 that an app's operator never pre-creates or chowns a host directory for the app's data, and no README tells him to (filed for pixa as https://git.eeqj.de/sneak/pixa/issues/159). The container sets its data directory's permissions itself. That covers ownership, but not existence. upaas mounts an app volume as a bind mount through Docker's mount API (`buildMounts` in `internal/docker/client.go`, `mount.TypeBind`), and Docker refuses a bind mount whose host path does not exist. upaas does not create the path first, so a new app's first deploy fails unless someone runs `mkdir` on the host, which the ruling rules out. ## Definition of done - Before creating an app's container, upaas creates each of the app's volume host paths that does not exist yet (`os.MkdirAll`, mode 0755, owned by root; the container fixes ownership itself). An existing path is left alone. - A test covers a missing path being created and an existing one being left untouched. - README: the volume section says upaas creates a missing host directory, and nothing tells the operator to create one. Model: opus-5-5
Author
Collaborator

Plan:

  • upaas runs in a container (docker-compose.yml), and an app's volume host path is a path on the host, not inside the upaas container. os.MkdirAll from upaas would create the directory in its own container, where Docker never looks. So the Docker daemon creates the path instead: buildMounts in internal/docker/client.go sets BindOptions.CreateMountpoint on each bind mount (Docker Engine 23 and later), which creates a missing host path and leaves an existing one alone. This replaces the os.MkdirAll step in the definition of done; the outcome is the same.
  • A test checks that every bind mount buildMounts returns asks Docker to create a missing host path, and that the rest of the mount is unchanged.
  • README: the volume section says upaas has Docker create a missing host directory, and nothing tells the operator to create one.

Model: opus-5-5

Plan: - upaas runs in a container (`docker-compose.yml`), and an app's volume host path is a path on the host, not inside the upaas container. `os.MkdirAll` from upaas would create the directory in its own container, where Docker never looks. So the Docker daemon creates the path instead: `buildMounts` in `internal/docker/client.go` sets `BindOptions.CreateMountpoint` on each bind mount (Docker Engine 23 and later), which creates a missing host path and leaves an existing one alone. This replaces the `os.MkdirAll` step in the definition of done; the outcome is the same. - A test checks that every bind mount `buildMounts` returns asks Docker to create a missing host path, and that the rest of the mount is unchanged. - README: the volume section says upaas has Docker create a missing host directory, and nothing tells the operator to create one. Model: opus-5-5
clawbot self-assigned this 2026-10-01 20:36:10 +02:00
Author
Collaborator

Built in #252 as planned above: Docker creates a missing volume host path when the app's container starts (Docker Engine 23.0 or later), and the README says so.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/upaas/pulls/252 as planned above: Docker creates a missing volume host path when the app's container starts (Docker Engine 23.0 or later), and the README says so. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/upaas#235