Skip to content

Commit

Permalink
chore: remove DBT_ env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
witash committed Aug 21, 2024
1 parent 4b484c9 commit af115dd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
3 changes: 0 additions & 3 deletions docker-compose.postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ services:
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- DBT_POSTGRES_USER=${DBT_POSTGRES_USER}
- DBT_POSTGRES_PASSWORD=${DBT_POSTGRES_PASSWORD}
- DBT_POSTGRES_SCHEMA=${DBT_POSTGRES_SCHEMA}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_TABLES=${COUCHDB_DBS}
- POSTGRES_SCHEMA=${POSTGRES_SCHEMA}
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ services:
build: ./dbt/
working_dir: /dbt/
environment:
- POSTGRES_HOST=${DBT_POSTGRES_HOST}
- POSTGRES_USER=${DBT_POSTGRES_USER}
- POSTGRES_PASSWORD=${DBT_POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_TABLE=${POSTGRES_TABLE}
- POSTGRES_SCHEMA=${DBT_POSTGRES_SCHEMA}
- POSTGRES_SCHEMA=${POSTGRES_SCHEMA}
- ROOT_POSTGRES_SCHEMA=${POSTGRES_SCHEMA}
- CHT_PIPELINE_BRANCH_URL=${CHT_PIPELINE_BRANCH_URL}
- DATAEMON_INTERVAL=${DATAEMON_INTERVAL}
Expand Down
6 changes: 1 addition & 5 deletions env.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=data
POSTGRES_SCHEMA=v1
POSTGRES_TABLE=medic # for dbt use only
POSTGRES_TABLE=couchdb
POSTGRES_HOST=postgres # Your postgres instance IP or endpoint in "prod".
POSTGRES_PORT=5432

# dbt
DBT_POSTGRES_USER=postgres
DBT_POSTGRES_PASSWORD=postgres
DBT_POSTGRES_SCHEMA=dbt
DBT_POSTGRES_HOST=postgres # Your postgres instance IP or endpoint in "prod".
CHT_PIPELINE_BRANCH_URL="https://github.com/medic/cht-pipeline.git#main"
DATAEMON_INTERVAL=5

Expand Down
14 changes: 7 additions & 7 deletions postgres/init-dbt-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export PGPASSWORD=$POSTGRES_PASSWORD
echo Setting up defaults

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER $DBT_POSTGRES_USER WITH PASSWORD '$DBT_POSTGRES_PASSWORD';
CREATE SCHEMA IF NOT EXISTS $DBT_POSTGRES_SCHEMA AUTHORIZATION $DBT_POSTGRES_USER;
CREATE USER $POSTGRES_USER WITH PASSWORD '$POSTGRES_PASSWORD';
CREATE SCHEMA IF NOT EXISTS $POSTGRES_SCHEMA AUTHORIZATION $POSTGRES_USER;
GRANT USAGE ON SCHEMA $POSTGRES_SCHEMA TO $DBT_POSTGRES_USER;
GRANT SELECT ON ALL TABLES IN SCHEMA $POSTGRES_SCHEMA TO $DBT_POSTGRES_USER;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA $POSTGRES_SCHEMA TO $DBT_POSTGRES_USER;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA $POSTGRES_SCHEMA TO $DBT_POSTGRES_USER;
GRANT USAGE ON SCHEMA $POSTGRES_SCHEMA TO $POSTGRES_USER;
GRANT SELECT ON ALL TABLES IN SCHEMA $POSTGRES_SCHEMA TO $POSTGRES_USER;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA $POSTGRES_SCHEMA TO $POSTGRES_USER;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA $POSTGRES_SCHEMA TO $POSTGRES_USER;
CREATE SCHEMA IF NOT EXISTS $DBT_POSTGRES_SCHEMA AUTHORIZATION $DBT_POSTGRES_USER;
CREATE SCHEMA IF NOT EXISTS $POSTGRES_SCHEMA AUTHORIZATION $POSTGRES_USER;
EOSQL

0 comments on commit af115dd

Please sign in to comment.