Skip to content

Commit

Permalink
fix: can't pass env to compose up, use env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
dshemetov committed Oct 13, 2023
1 parent fdcdb08 commit cb005b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ jobs:
ln -s repos/delphi/delphi-epidata/dev/local/pyproject.toml repos/
ln -s repos/delphi/delphi-epidata/dev/local/setup.cfg repos/
- name: Build docker images
run: |
make db
make web
make redis
- name: Run tests
run: |
make test
Expand Down
15 changes: 6 additions & 9 deletions dev/local/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ NOW:=$(shell date "+%Y-%m-%d")
LOG_WEB:=delphi_web_epidata_$(NOW).log
LOG_DB:=delphi_database_epidata_$(NOW).log
LOG_REDIS:=delphi_redis_instance_$(NOW).log
WEB_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_web_epidata')
DATABASE_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_database_epidata')
REDIS_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_redis')

M1=
ifeq ($(shell uname -smp), Darwin arm64 arm)
Expand All @@ -82,9 +79,7 @@ db:

.PHONY=web
web:
@docker compose up delphi_web_epidata $(M1) \
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
--detach
@SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) docker compose up delphi_web_epidata $(M1) --detach
@docker logs -f delphi_web_epidata >$(LOG_WEB) 2>&1 &

.PHONY=redis
Expand All @@ -94,15 +89,17 @@ redis:

.PHONY=test
test:
@docker compose run delphi_web_python $(M1) python -m pytest --import-mode importlib $(pdb) $(test) | tee test_output_$(NOW).log
@SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) docker compose run delphi_web_python $(M1) \
python -m pytest --import-mode importlib $(pdb) $(test) | tee test_output_$(NOW).log

.PHONY=r-test
r-test:
@docker compose run delphi_web_python $(M1) Rscript repos/delphi/delphi-epidata/integrations/client/test_delphi_epidata.R | tee r-test_output_$(NOW).log
@SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) docker compose run delphi_web_python $(M1) \
Rscript repos/delphi/delphi-epidata/integrations/client/test_delphi_epidata.R | tee r-test_output_$(NOW).log

.PHONY=bash
bash:
@docker compose run delphi_web_python $(M1) bash
@SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) docker compose run delphi_web_python $(M1) bash

.PHONY=sql
sql:
Expand Down
4 changes: 2 additions & 2 deletions dev/local/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
dockerfile: ./devops/Dockerfile
environment:
MODULE_NAME: delphi.epidata.server.main
SQLALCHEMY_DATABASE_URI: mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
SQLALCHEMY_DATABASE_URI: ${SQLALCHEMY_DATABASE_URI:-mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata}
FLASK_SECRET: abc
FLASK_PREFIX: /epidata
LOG_DEBUG: "1"
Expand Down Expand Up @@ -68,7 +68,7 @@ services:
context: .
dockerfile: repos/delphi/delphi-epidata/dev/docker/python/Dockerfile
environment:
SQLALCHEMY_DATABASE_URI: mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
SQLALCHEMY_DATABASE_URI: ${SQLALCHEMY_DATABASE_URI:-mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata}
FLASK_SECRET: abc
volumes:
- type: bind
Expand Down

0 comments on commit cb005b2

Please sign in to comment.