Skip to content

Commit

Permalink
fix(#182): add dbt-local-path
Browse files Browse the repository at this point in the history
  • Loading branch information
witash committed Nov 21, 2024
1 parent 98771d2 commit d8e8324
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dbt/dbt-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ def get_package():
"revision": init_package.fragment
}]})

if os.getenv("DBT_LOCAL_PATH"):
package_json = json.dumps({"packages": [{
"local": '/dbt/local/'
}]})

with open("/dbt/packages.yml", "w") as f:
f.write(package_json)

Expand Down
43 changes: 43 additions & 0 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ${COMPOSE_PROJECT_NAME:-cht-sync}
services:
couch2pg:
build: ./couch2pg/
extra_hosts:
- "host.docker.internal:host-gateway"
logging:
driver: "json-file"
options:
max-size: "512m"
environment:
- COUCHDB_USER=${COUCHDB_USER}
- COUCHDB_PASSWORD=${COUCHDB_PASSWORD}
- COUCHDB_HOST=${COUCHDB_HOST}
- COUCHDB_DBS=${COUCHDB_DBS}
- COUCHDB_PORT=${COUCHDB_PORT}
- COUCHDB_SECURE=${COUCHDB_SECURE:-true}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_PORT=5432
- POSTGRES_SCHEMA=${POSTGRES_SCHEMA}
- POSTGRES_TABLE=${POSTGRES_TABLE}
restart: always

dbt:
build: ./dbt/
working_dir: /dbt/
volumes:
- "${DBT_LOCAL_PATH:-dbt}:/dbt/local/"
environment:
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_TABLE=${POSTGRES_TABLE}
- POSTGRES_SCHEMA=${POSTGRES_SCHEMA}
- ROOT_POSTGRES_SCHEMA=${POSTGRES_SCHEMA}
- CHT_PIPELINE_BRANCH_URL=${CHT_PIPELINE_BRANCH_URL}
- DATAEMON_INTERVAL=${DATAEMON_INTERVAL}
- DBT_PACKAGE_TARBALL_URL=${DBT_PACKAGE_TARBALL_URL}
- DBT_LOCAL_PATH=${DBT_LOCAL_PATH}
3 changes: 3 additions & 0 deletions env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ POSTGRES_PORT=5432
CHT_PIPELINE_BRANCH_URL="https://github.com/medic/cht-pipeline.git#main"
DATAEMON_INTERVAL=5

# if running locally, path to pipeline
DBT_LOCAL_PATH="/path/to/cht-pipeline/"

# couchdb
COUCHDB_USER=medic
COUCHDB_PASSWORD=password
Expand Down

0 comments on commit d8e8324

Please sign in to comment.