Skip to content

Commit

Permalink
Working Docker Compose sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline committed Jan 3, 2024
1 parent 4fef125 commit e6d398f
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 10 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ dev-install: build
python3 -m pip uninstall -y dbt-metabase \
&& python3 -m pip install dist/dbt_metabase-*-py3-none-any.whl
.PHONY: dev-install

dev-sandbox:
( cd sandbox \
&& mkdir -p volumes \
&& cp -r fixtures/* volumes/ \
&& docker-compose up \
; docker-compose down )
.PHONY: dev-sandbox
5 changes: 2 additions & 3 deletions sandbox/.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
POSTGRES_HOST=172.17.0.1
POSTGRES_USER=dbtmetabase
POSTGRES_PASSWORD=dbtmetabase
POSTGRES_DB=postgres
POSTGRES_PASSWORD=dbtmetabase1
POSTGRES_DB=dbtmetabase
POSTGRES_SCHEMA=public
POSTGRES_PORT=5432
MB_PORT=3000
3 changes: 1 addition & 2 deletions sandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/target/
/postgres-data/
/metabase-data/
/volumes/
8 changes: 8 additions & 0 deletions sandbox/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config:
dbt_manifest_path: ./sandbox/target/manifest.json
dbt_database: dbtmetabase
metabase_url: http://localhost:3000
# Pre-configured in Metabase fixtures
metabase_database: dbtmetabase
metabase_username: [email protected]
metabase_password: dbtmetabase1
31 changes: 26 additions & 5 deletions sandbox/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,31 @@ services:
- POSTGRES_DB=${POSTGRES_DB:-}
ports:
- ${POSTGRES_PORT}:5432
networks:
- common
volumes:
- ./postgres-data:/var/lib/postgresql/data
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER"]
interval: 5s
timeout: 5s
retries: 5
restart: always

metabase:
image: metabase/metabase:latest
environment:
- MB_DB_FILE=/metabase-data/metabase.db
- MB_DB_FILE=/metabase.db
ports:
- ${MB_PORT}:3000
networks:
- common
volumes:
- ./metabase-data:/metabase-data
- ./volumes/metabase.db:/metabase.db
restart: always
depends_on:
postgres:
condition: service_healthy

dbt:
build: .
Expand All @@ -33,8 +45,17 @@ services:
- POSTGRES_DB=${POSTGRES_DB:-}
- POSTGRES_SCHEMA=${POSTGRES_SCHEMA:-}
- POSTGRES_PORT=${POSTGRES_PORT:-}
- POSTGRES_HOST=172.17.0.1
- POSTGRES_HOST=postgres
networks:
- common
volumes:
- ./target:/app/target
depends_on:
- postgres
postgres:
condition: service_healthy

networks:
common:

volumes:
postgres-data:
Binary file added sandbox/fixtures/metabase.db/metabase.db.mv.db
Binary file not shown.

0 comments on commit e6d398f

Please sign in to comment.