Provision and apply the schema from Compose (task 205) #145
Loading…
Reference in a new issue
No description provided.
Delete branch "task-205-compose-auto-schema"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two new
full-profile services,provisionthenschema-upgrade, run ahead ofapiand gate it withservice_completed_successfully— a failed step stopsapistarting at all.PlaceMark.Databasegets a Dockerfile (none existed), following ADR-0104's shape: pinned SDK to build,runtime:10.0-alpineto run (no ASP.NET dependency, unlikeapi/webui), non-root.The decision the ticket left open: provisioning runs automatically too, not schema-only.
provisionconnects as the superuser Compose already creates, and grants nothing wider than theprovisioncommand already has. This is what makes a fresh clone'sdocker compose --profile full up --waitwork unattended — verified directly on a throwaway volume, not assumed. No seed role by default (matches CI's own provisioning step); overridable via.env.Verified directly, not just built: fresh volume brings the whole stack up and reaches
apihealthy with schema applied; torn down and brought up again is a no-op (Password reset on: ...,No pending scripts); a deliberately broken script leavesapiin Compose's owncreatedstate, never started, naming the exact failure.docker compose upwith no profile still starts postgres alone (docker compose config --services).ADR-0123, README's "Full local stack" section rewritten to match,
.env.exampleupdated with the two new overridable passwords.Verdict: mergeable
Reviewed at
137149d(commit_id matches head). CI green (build + e2e, run #523).Reproduced the load-bearing claims directly, on an isolated project name/ports/volume (
placemark-review145) so Rob's ownplacemark-postgres-1andpostgres-datawere never touched — confirmed both before and after:docker compose --profile full up -d --build --wait:provision→schema-upgrade→api/webui, all healthy, unattended. Then a genuinely malformed script (my first attempt used a valid--SQL comment and proved nothing — redid it with actual garbage):schema-upgradeexited 1 naming the exact script and Postgres's own syntax error, andapi-1/webui-1both stayed in Compose'sCreatedstate,StartedAtthe zero value, never started. Matches the ADR's own account exactly.provisionreportsPassword reset on: ...andschema-upgradereportsNo pending scripts,apireaching healthy again with no failures.docker compose upstill starts postgres alone —docker compose config --servicesreturns onlypostgreswith no profile flag,--profile full config --servicesreturns all five.docker-compose.yml,.env.exampleand the ADR consistently, matching CI's own provisioning step, with the drop-on-rerun behaviour called out plainly in both.env.exampleand the README.USER $APP_UID,runtime(notaspnet) base since it has no ASP.NET dependency, noEXPOSE/healthcheck since it runs to completion. Builds clean from this head, which already has #146's SSH.NET pin merged in — and structurally can't have been at risk from that change anyway: this Dockerfile restores onlyPlaceMark.Database.csprojdirectly, which carries no reference to any of the three test projects #146 touched.provision/schema-upgrade commands are gone from that section, replaced with the automatic account; the plain Postgres-only workflow above it is untouched, still manual, as it should be.One non-issue worth recording rather than raising: both
provisionandschema-upgradelog aCannot load library libgssapi_krb5.so.2line on every run. Confirmed this is pre-existing and not introduced here —PlaceMark.Api's own already-shippedaspnet:10.0-alpineimage logs the identical line and has for as long as that Dockerfile has existed; it's Npgsql's own harmless GSSAPI probe against an Alpine base with nokrb5-libs, and every command still exits 0 and does what it says. Not this PR's to fix.Nothing outside
.dockerignore,.env.example,README.md,docker-compose.yml, the new ADR/index entry and the new Dockerfile changed.