Brick Work

0025. Containers set up a missing collection before starting the server

Context

A fresh container on an empty, writable appdata folder answers health checks with 503 not_set_up until someone runs brickwork setup; NAS interfaces have no console setup step. The app resolves its collection path from configuration, including BW_DB_PATH in the environment or data/.env, so a shell path check would miss some configurations. Gunicorn also logs a control-socket permission error when HOME is unwritable, including when Unraid runs the container as 99:100.

Decision

After checking that /app/data is writable, the entrypoint runs brickwork setup --if-missing. The app's own path rules decide which collection to check. With this flag, any existing path counts as a collection in any format: setup succeeds without opening, migrating, seeding or changing it, so required migration is never bypassed. A missing collection is created and seeded as with plain setup; the first-run page handles the catalogue and nothing is downloaded at startup. Plain brickwork setup keeps its existing behavior. Setup failure stops the container before Gunicorn starts.

Gunicorn gets --no-control-socket before the user's arguments. The control socket is unused by Brick Work; there is no way to re-enable it by argument after this flag.

Consequences

Issues #266 and #265; CLI reference.