chore(dev): move RLS bootstrap to postgres initdb.d, drop password-drift reset #353
Loading…
Reference in a new issue
No description provided.
Delete branch "chore/PMS-488-postgres-initdb-rls"
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?
What
Replaces the
postgresservice's 58-lineentrypoint:override incompose.dev.ymlwith a first-init script (scripts/pg-init.sh) mounted at/docker-entrypoint-initdb.d/00-init.sh.The override bundled three unrelated jobs: a password-drift reset, the PMS-285 RLS role split (
mokosh_migratorBYPASSRLS +mokosh_appNOBYPASSRLS), and superuser-only bootstrap the migrations cannot do themselves (four untrustedCREATE EXTENSIONs +GRANT CREATE ON DATABASEto the migrator).Changes
just dev-cleanand re-provision from a fresh volume.scripts/pg-init.sh. The postgres image runs it once on an empty volume, as the superuser over the trusted local socket, before the TCP listener opens.postgres:5432) can no longer race role/extension creation - a window the backgrounded entrypoint had.CREATE, andON_ERROR_STOP=1aborts boot loudly on a real failure instead of the old|| echo ...continuing.Verification
docker compose -f compose.dev.yml configparses; noentrypoint:key remains; mount present.sh -n scripts/pg-init.shpasses;just pre-commitgreen.just dev-clean && just dev, then\du mokosh_migrator mokosh_app(migrator shows Bypass RLS, app does not),\dxlists uuid-ossp/pg_trgm/citext/pgcrypto, migrations apply with no permission-denied andCREATE SCHEMA mokosh_authsucceeds.#PMS-488