-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CE-273] Add dev/production start options
Use different compose file for start service depend on DEV Set DEV=False as default value Change-Id: Ide9cb92cd7039cf8ce5dc355fd363c5d7de7221e Signed-off-by: Haitao Yue <hightall@me.com>
- Loading branch information
Showing
7 changed files
with
299 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Theme name for admin dashboard basic/vue/react | ||
THEME?=basic | ||
STATIC_FOLDER?=themes\/${THEME}\/static | ||
TEMPLATE_FOLDER?=themes\/${THEME}\/templates | ||
# npm registry repo | ||
NPM_REGISTRY?=https://registry.npmjs.org | ||
# service running dev/production mode | ||
DEV?=True | ||
DEV?=False | ||
# whether enable user active, if enable user must be active to use user dashboard | ||
ENABLE_EMAIL_ACTIVE?=False | ||
|
||
NPM_REGISTRY_REPLACE=$(subst $(SLASH),$(REPLACE_SLASH),$(NPM_REGISTRY)) | ||
|
||
ifeq (${DEV}, True) | ||
DEPLOY_COMPOSE_FILE:=docker-compose-dev.yml | ||
else | ||
DEPLOY_COMPOSE_FILE:=docker-compose.yml | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
# This compose file will deploy the services, and bootup a mongo server. | ||
|
||
# Copyright IBM Corp., All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Local `/opt/cello/mongo` will be used for the db storage. | ||
|
||
# cello-nginx: proxy to access operator dashboard service, listen on 8080 | ||
# cello-operator-dashboard: dashboard service for operators | ||
# cello-user-dashboard: user service of cello, listen on 8081 | ||
# engine: engine service of cello to provide RESTful APIs, listen on 80 | ||
# cello-mongo: mongo db | ||
|
||
version: '3.2' | ||
services: | ||
# nginx as front end for the operator dashboard | ||
nginx: | ||
image: hyperledger/cello-nginx | ||
hostname: cello-nginx | ||
container_name: cello-nginx | ||
restart: always | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '0.50' | ||
memory: 2048M | ||
reservations: | ||
cpus: '0.10' | ||
memory: 256M | ||
volumes: | ||
- ./nginx/nginx.conf:/etc/nginx/nginx.default.conf | ||
#- /opt/cello/nginx/log/:/var/log/nginx/ | ||
ports: | ||
- "80:80" | ||
- "8080:8080" | ||
environment: | ||
- BACKEND=cello-operator-dashboard | ||
- PORT=8080 | ||
- USERNAME=admin | ||
- PASSWORD=pass | ||
|
||
# cello dashboard service for network operator | ||
operator-dashboard: | ||
image: hyperledger/cello-operator-dashboard | ||
container_name: cello-operator-dashboard | ||
hostname: cello-operator-dashboard | ||
restart: unless-stopped | ||
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 | ||
- STATIC_FOLDER=$STATIC_FOLDER | ||
- TEMPLATE_FOLDER=$TEMPLATE_FOLDER | ||
- ENABLE_EMAIL_ACTIVE=$ENABLE_EMAIL_ACTIVE | ||
expose: | ||
- "8080" | ||
volumes: # This should be removed in product env | ||
- ./src:/app | ||
|
||
#TODO: need to follow other images to put at dockerhub | ||
user-dashboard: | ||
image: hyperledger/cello-user-dashboard | ||
container_name: cello-user-dashboard | ||
hostname: cello-user-dashboard | ||
links: | ||
- mongo:dashboard_mongo | ||
- dashboard_mongo | ||
- operator-dashboard | ||
ports: | ||
- "8081:8080" | ||
environment: | ||
- SV_BaseURL=http://operator-dashboard:8080/api/ | ||
- RESTful_Server=operator-dashboard:8080 | ||
- RESTful_BaseURL=/api/ | ||
- DEBUG=node:* | ||
- DEV=$DEV | ||
- ENABLE_EMAIL_ACTIVE=$ENABLE_EMAIL_ACTIVE | ||
- SMTP_SERVER=$SMTP_SERVER | ||
- SMTP_PORT=$SMTP_PORT | ||
- SMTP_AUTH_USERNAME=$SMTP_AUTH_USERNAME | ||
- SMTP_AUTH_PASSWORD=$SMTP_AUTH_PASSWORD | ||
- FROM_EMAIL=$FROM_EMAIL | ||
- WEBROOT=$WEBROOT | ||
- FABRIC_CFG_PATH=/etc/hyperledger/fabric | ||
volumes: | ||
- ./user-dashboard:/usr/app/src | ||
- /opt/cello/baas:/opt/data | ||
command: bash -c "cd /usr/app/src && [ "$DEV" = True ] && npm run dev || npm start" | ||
|
||
# cello engine service | ||
engine: | ||
image: hyperledger/cello-engine | ||
container_name: cello-engine | ||
hostname: cello-engine | ||
restart: unless-stopped | ||
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 | ||
expose: | ||
- "80" | ||
volumes: # This should be removed in product env | ||
- ./src:/app | ||
|
||
# cello watchdog service | ||
watchdog: | ||
image: hyperledger/cello-watchdog | ||
container_name: cello-watchdog | ||
hostname: cello-watchdog | ||
restart: unless-stopped | ||
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 | ||
volumes: # This should be removed in product env | ||
- ./src:/app | ||
|
||
# mongo database, may use others in future | ||
mongo: | ||
image: hyperledger/cello-mongo | ||
hostname: cello-mongo | ||
container_name: cello-mongo | ||
restart: unless-stopped | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '0.50' | ||
memory: 2048M | ||
reservations: | ||
cpus: '0.10' | ||
memory: 256M | ||
ports: | ||
#- "27017:27017" # use follow line instead in production env | ||
- "127.0.0.1:27017:27017" | ||
- "127.0.0.1:27018:27018" | ||
environment: | ||
- NO_USED=0 | ||
volumes: | ||
- /opt/cello/mongo:/data/db | ||
|
||
# TODO: we may use one mongo instance, that should be enough | ||
dashboard_mongo: | ||
image: hyperledger/cello-mongo | ||
restart: unless-stopped | ||
environment: | ||
- NO_USED=0 | ||
volumes: | ||
- /opt/cello/dashboard_mongo:/data/db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.