diff --git a/.makerc/operator-dashboard b/.makerc/operator-dashboard index 77ebb49eb..d9deb2063 100644 --- a/.makerc/operator-dashboard +++ b/.makerc/operator-dashboard @@ -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 diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 3214ebf20..ad913cfb7 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -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 @@ -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 @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index e56a80b75..4918867aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 @@ -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: @@ -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 diff --git a/dockerhub/latest/operator-dashboard/Dockerfile b/dockerhub/latest/operator-dashboard/Dockerfile index 70a77748f..08a58ed7e 100644 --- a/dockerhub/latest/operator-dashboard/Dockerfile +++ b/dockerhub/latest/operator-dashboard/Dockerfile @@ -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 diff --git a/env.tmpl b/env.tmpl index 7fdcb4376..d6a271f5e 100644 --- a/env.tmpl +++ b/env.tmpl @@ -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