Skip to content

Commit

Permalink
[CE-339] Support DEBUG & LOG_LEVEL dynamic.
Browse files Browse the repository at this point in the history
DEBUG & LOG_LEVEL can change through makefile.

Change-Id: Iea878f207426cf43b173ecab40e475cc627f66ec
Signed-off-by: Haitao Yue <hightall@me.com>
  • Loading branch information
hightall committed Apr 14, 2018
1 parent 99f3793 commit 07f39e3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .makerc/operator-dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export ENABLE_EMAIL_ACTIVE?=False
NPM_REGISTRY_REPLACE=$(subst $(SLASH),$(REPLACE_SLASH),$(NPM_REGISTRY))

ifeq (${DEV}, True)
export LOG_LEVEL:=DEBUG
DEPLOY_COMPOSE_FILE:=docker-compose-dev.yml
else
export LOG_LEVEL:=INFO
DEPLOY_COMPOSE_FILE:=docker-compose.yml
endif
12 changes: 6 additions & 6 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ services:
environment:
- MONGO_URL=mongodb://cello-mongo:27017
- MONGO_DB=dev
- DEBUG=True # in debug mode, service will auto-restart
- LOG_LEVEL=DEBUG # what level log will be output
- DEBUG=$DEV # in debug mode, service will auto-restart
- LOG_LEVEL=$LOG_LEVEL # what level log will be output
- STATIC_FOLDER=$STATIC_FOLDER
- TEMPLATE_FOLDER=$TEMPLATE_FOLDER
- ENABLE_EMAIL_ACTIVE=$ENABLE_EMAIL_ACTIVE
Expand Down Expand Up @@ -98,8 +98,8 @@ services:
environment:
- MONGO_URL=mongodb://cello-mongo:27017
- MONGO_DB=dev
- DEBUG=True # in debug mode, service will auto-restart
- LOG_LEVEL=DEBUG # what level log will be output
- DEBUG=$DEV # in debug mode, service will auto-restart
- LOG_LEVEL=$LOG_LEVEL # what level log will be output
expose:
- "80"
volumes: # This should be removed in product env
Expand All @@ -114,8 +114,8 @@ services:
environment:
- MONGO_URL=mongodb://cello-mongo:27017
- MONGO_DB=dev
- DEBUG=True # in debug mode, service will auto-restart
- LOG_LEVEL=DEBUG # what level log will be output
- DEBUG=$DEV # in debug mode, service will auto-restart
- LOG_LEVEL=$LOG_LEVEL # what level log will be output
volumes: # This should be removed in product env
- ./src:/app

Expand Down
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ services:
- MONGO_HOST=mongo
- MONGO_DB=dev
- MONGODB_PORT=27017
- DEBUG=True # in debug mode, service will auto-restart
- LOG_LEVEL=DEBUG # what level log will be output
- DEBUG=$DEV # in debug mode, service will auto-restart
- LOG_LEVEL=$LOG_LEVEL # what level log will be output
- STATIC_FOLDER=$STATIC_FOLDER
- TEMPLATE_FOLDER=$TEMPLATE_FOLDER
- ENABLE_EMAIL_ACTIVE=$ENABLE_EMAIL_ACTIVE
Expand Down Expand Up @@ -98,8 +98,8 @@ services:
- MONGO_HOST=mongo
- MONGO_DB=dev
- MONGODB_PORT=27017
- DEBUG=True # in debug mode, service will auto-restart
- LOG_LEVEL=DEBUG # what level log will be output
- DEBUG=$DEV # in debug mode, service will auto-restart
- LOG_LEVEL=$LOG_LEVEL # what level log will be output
ports:
- "80:80"
#volumes:
Expand All @@ -116,8 +116,8 @@ services:
- MONGO_HOST=mongo
- MONGO_DB=dev
- MONGODB_PORT=27017
- DEBUG=True # in debug mode, service will auto-restart
- LOG_LEVEL=DEBUG # what level log will be output
- DEBUG=$DEV # in debug mode, service will auto-restart
- LOG_LEVEL=$LOG_LEVEL # what level log will be output
#volumes:
# - ./src:/app

Expand Down
7 changes: 1 addition & 6 deletions dockerhub/latest/operator-dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@
#
FROM hyperledger/cello-baseimage:x86_64-latest

# use this in development
CMD ["python", "dashboard.py"]

# use this in product
#CMD ["gunicorn", "-w", "128", "-b", "0.0.0.0:8080", "dashboard:app"]

CMD if [ "$DEBUG" = "True" ]; then python dashboard.py ; else gunicorn -w $(( 2 * `cat /proc/cpuinfo | grep "core id" | wc -l` + 1 )) -b 0.0.0.0:8080 dashboard:app ;fi
1 change: 1 addition & 0 deletions env.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ STATIC_FOLDER=themes/$THEME/static
TEMPLATE_FOLDER=themes/$THEME/templates
NPM_REGISTRY=$NPM_REGISTRY
DEV=$DEV
LOG_LEVEL=$LOG_LEVEL
ROOT_PATH=$ROOT_PATH
ENABLE_EMAIL_ACTIVE=$ENABLE_EMAIL_ACTIVE
SMTP_SERVER=$SMTP_SERVER
Expand Down

0 comments on commit 07f39e3

Please sign in to comment.