Skip to content

Commit

Permalink
source-postgres: initdb tweaks to make CI work
Browse files Browse the repository at this point in the history
For some reason the test suite works fine locally when running
against the dockerized test Postgres instance, but when running
in a CI build it fails because when user `flow_capture` tries to
create the `public.flow_watermarks` table they get a permission
denied error.

Which is doubly weird because:

  1. A newly created user should by default have permissions to
     interact with the `public` schema and create tables there.
  2. It works when running locally, and both local and CI builds
     are using the same `source-postgres/docker-compose.yaml` and
     just running `docker compose up` on that, so they should have
     identical behavior.

So let's see if explicitly granting `flow_capture` the `CREATE`
and `USAGE` permissions on schema `public` fixes the inconsistency.
  • Loading branch information
willdonnelly committed Mar 15, 2023
1 parent 0b18db3 commit 676e8f2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source-postgres/docker-entrypoint-initdb.d/init-user-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-E
ALTER DEFAULT PRIVILEGES IN SCHEMA test GRANT SELECT ON TABLES to flow_capture;
GRANT SELECT ON ALL TABLES IN SCHEMA test TO flow_capture;
GRANT CREATE, USAGE ON SCHEMA public TO flow_capture;
CREATE PUBLICATION flow_publication FOR ALL TABLES;
EOSQL

0 comments on commit 676e8f2

Please sign in to comment.