From e0f577571bcdd7d61b8443d1093578ce8aa51b6f Mon Sep 17 00:00:00 2001 From: Yuanmao Zhu Date: Fri, 17 Feb 2023 23:45:24 -0500 Subject: [PATCH] Fix makefile Signed-off-by: Yuanmao Zhu --- Makefile | 165 +++++++++++------- .../docker-compose-files/docker-compose.yml | 2 +- docs/concepts.md | 14 +- docs/contributing.md | 106 +++++++++++ docs/requirements.txt | 5 +- mkdocs.yml | 93 +++++----- scripts/master_node/download_images.sh | 33 ++-- scripts/master_node/setup.sh | 4 +- scripts/worker_node/download_images.sh | 93 +++++----- 9 files changed, 330 insertions(+), 185 deletions(-) create mode 100644 docs/contributing.md mode change 100644 => 100755 scripts/master_node/download_images.sh diff --git a/Makefile b/Makefile index 6b3d7a371..336938a6a 100755 --- a/Makefile +++ b/Makefile @@ -5,12 +5,23 @@ # # ------------------------------------------------------------- # This makefile defines the following targets, feel free to run "make help" to see help info -# -# - clean: Cleans the build area -# - dockerhub-pull: Pulling service images from dockerhub -# - reset: Clean up and remove local storage (only use for development) +# - all (default): Builds all targets and runs all tests/checks +# - license: Checks sourrce files for Apache license header +# - check: Setup as master node, and runs all tests/checks, will be triggered by CI +# - help: Output the help instructions for each command +# - doc: Start a local web service to explore the documentation +# - docker[-clean]: Build/clean docker images locally # - start: Start the cello service # - stop: Stop the cello service, and remove all service containers +# - restart: Stop the cello service and then start +# - setup-master: Setup the host as a master node, install pkg and download docker images +# - setup-worker: Setup the host as a worker node, install pkg and download docker images +# - clean: Cleans the docker containers. +# - deep-clean: Clean up all docker images and local storage. +# - docker-compose: Start development docker-compose. +# - local: Run all services ad-hoc +# - reset: Clean up and remove local storage (only use for development) + GREEN := $(shell tput -Txterm setaf 2) WHITE := $(shell tput -Txterm setaf 7) @@ -99,9 +110,21 @@ else export DEBUG?=True endif -docker-clean: stop image-clean ##@Clean all existing images - -license: +HELP_FUN = \ + %help; \ + while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \ + print "usage: make [target]\n\n"; \ + for (sort keys %help) { \ + print "${WHITE}$$_:${RESET}\n"; \ + for (@{$$help{$$_}}) { \ + $$sep = " " x (32 - length $$_->[0]); \ + print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \ + }; \ + print "\n"; } + +all: check + +license: ##@Code Check source files for Apache license header scripts/check_license.sh check: ##@Code Check code format @@ -115,90 +138,114 @@ check: ##@Code Check code format MODE=dev make stop make check-dashboard -check-dashboard: - docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1) +doc: ##@Documentation Build local online documentation and start serve + command -v mkdocs >/dev/null 2>&1 || pip install -r docs/requirements.txt || pip3 -r docs/requirements.txt + mkdocs serve -f mkdocs.yml -clean: - make remove-docker-compose +help: ##@Help Show this help. + @perl -e '$(HELP_FUN)' $(MAKEFILE_LIST) -deep-clean: +docker: images ##@Build Build all required docker images locally + +docker-clean:##@Clean Clean docker images locally + make stop + make clean-images + +start: ##@Service Start service + make start-docker-compose + +stop: ##@Service Stop service + if [ "$(CONFIG_DOCKER_COMPOSE_DEPLOY)" = "y" ]; then \ + make stop-docker-compose; \ + else \ + make stop-k8s; \ + fi + +restart: stop start ##@Service Restart services + +setup-master: ##@Environment Setup dependency for master node + cd scripts/master_node && bash setup.sh + +setup-worker: ##@Environment Setup dependency for worker node + cd scripts/worker_node && bash setup.sh $(WORKER_TYPE) + +clean: ##@Clean Stop services and clean docker containers. + make stop + if docker ps -a | grep "cello-"; then \ + docker ps -a | grep "cello-" | awk '{print $1}' | xargs docker rm -f >/dev/null 2>&1; \ + fi + +deep-clean: ##@Clean Stop services, clean docker images and remove mounted local storage. + make stop make clean - make remove-hyperledger-fabric-containers - make image-clean + make clean-docker-images rm -rf $(LOCAL_STORAGE_PATH) -image-clean: clean ##@Clean all existing images to rebuild +docker-compose:##@Development Start development docker-compose + api-engine fabric docker-rest-agent dashboard + +reset:##@Development clean up and remove local storage (only use for development) + make clean + echo "Clean up and remove all local storage..." + rm -rf ${LOCAL_STORAGE_PATH}/* + +local:##@Development Run all services ad-hoc + make docker-compose start-docker-compose + +## Help rules +clean-images: + make clean echo "Clean all cello related images, may need to remove all containers before" docker images | grep "cello-" | awk '{print $3}' | xargs docker rmi -f +check-dashboard: + docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1) + start-docker-compose: docker compose -f bootup/docker-compose-files/${COMPOSE_FILE} up -d --force-recreate --remove-orphans -start: ##@Service Start service - make start-docker-compose - stop-docker-compose: echo "Stop all services with bootup/docker-compose-files/${COMPOSE_FILE}..." docker compose -f bootup/docker-compose-files/${COMPOSE_FILE} stop echo "Stop all services successfully" -remove-docker-compose: - make stop-docker-compose - echo "Remove all services with bootup/docker-compose-files/${COMPOSE_FILE}..." - if docker ps -a | grep "cello-"; then \ - docker ps -a | grep "cello-" | awk '{print $1}' | xargs docker rm -f >/dev/null 2>&1; \ - rm -rf /opt/cello; \ - fi - echo "Remove all services successfully" - -remove-hyperledger-fabric-containers: - echo "Remove all nodes ..." - if docker ps -a | grep "hyperledger-fabric"; then \ - docker ps -a | grep "hyperledger-fabric" | awk '{print $1}' | xargs docker rm -f >/dev/null 2>&1; \ - rm -rf /opt/hyperledger; \ - fi - echo "Remove all nodes successfully" - -stop: ##@Service Stop service - if [ "$(CONFIG_DOCKER_COMPOSE_DEPLOY)" = "y" ]; then \ - make stop-docker-compose; \ - else \ - make stop-k8s; \ - fi - -restart: stop start ##@Service Restart service +images: api-engine docker-rest-agent fabric dashboard -api-engine: # for debug only now - docker build -t hyperledger/cello-api-engine:latest -f build_image/docker/common/api-engine/Dockerfile.in ./ --platform linux/$(ARCH); \ +api-engine: + docker build -t hyperledger/cello-api-engine:latest -f build_image/docker/common/api-engine/Dockerfile.in ./ --platform linux/$(ARCH) -docker-rest-agent: # for debug only now - docker build -t hyperledger/cello-agent-docker:latest -f build_image/docker/agent/docker-rest-agent/Dockerfile.in ./ --build-arg pip=$(PIP) --platform linux/$(ARCH); \ +docker-rest-agent: + docker build -t hyperledger/cello-agent-docker:latest -f build_image/docker/agent/docker-rest-agent/Dockerfile.in ./ --build-arg pip=$(PIP) --platform linux/$(ARCH) fabric: docker image pull yeasy/hyperledger-fabric:2.2.0 -dashboard: # for debug only now +dashboard: docker build -t hyperledger/cello-dashboard:latest -f build_image/docker/common/dashboard/Dockerfile.in ./ -docker-compose: api-engine fabric docker-rest-agent dashboard -local: docker-compose start-docker-compose .PHONY: \ - deep-clean \ - docker-clean \ + all \ license \ - stop-docker-compose \ - remove-docker-compose \ - remove-hyperledger-fabric-containers \ - restart \ + check \ + doc \ + help \ + docker \ + docker-clean \ start \ + stop \ + restart \ + clean \ + deep-clean \ api-engine \ fabric \ - docker-rest-agent \ dashboard \ docker-compose \ + reset \ local \ - check \ - check-dashboard \ + clean-images \ + start-docker-compose \ + stop-docker-compose \ + images \ diff --git a/bootup/docker-compose-files/docker-compose.yml b/bootup/docker-compose-files/docker-compose.yml index 589a98495..be0767b73 100644 --- a/bootup/docker-compose-files/docker-compose.yml +++ b/bootup/docker-compose-files/docker-compose.yml @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: Apache-2.0 # -# Local `/opt/cello/mongo` will be used for the db storage. +# Local `/opt/cello` 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 diff --git a/docs/concepts.md b/docs/concepts.md index 3f3b66f56..736d10649 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -10,14 +10,15 @@ Api engine supply the core function, all operations through the api service. Host path mappings: -* /opt/cello/api-engine/media:/var/www/media {>>store all media files<<} -* /var/run/docker.sock:/var/run/docker.sock {>>Used for agent containers launch, which will deploy fabric, eg. network<<} -* (==optional==) $ROOT_PATH/src/api-engine:/var/www/server {>>When run in debug mode, MODE=dev, will mapping the source code into container, ROOT_PATH is the source code path.<<} +- /opt/cello/api-engine/media:/var/www/media {>>store all media files<<} +- /var/run/docker.sock:/var/run/docker.sock {>>Used for agent containers launch, which will deploy fabric, eg. network<<} +- (==optional==) $ROOT_PATH/src/api-engine:/var/www/server {>>When run in debug mode, MODE=dev, will mapping the source code into container, ROOT_PATH is the source code path.<<} #### 1.1.2 API Engine Tasks This component run all the async longtime task for api engine, it's receive tasks through redis, and can dynamic set the thread pool. - ``` + +``` #### 1.1.3 Postgres @@ -25,7 +26,7 @@ Store all the data in postgres database, and the storage path is mapping out on Host path mappings: -* /opt/cello/postgres:/var/lib/postgresql/data {>>Store all db data.<<} +- /opt/cello/postgres:/var/lib/postgresql/data {>>Store all db data.<<} #### 1.1.4 Redis @@ -41,8 +42,9 @@ Host path mappings: ### 2.1 [Kubernetes](agents/kubernetes.md) -### 2.2 [Ansible](agents/ansible.md) +### 2.2 [Fabric Operator](agents/fabric-operator.md) [^1]: running containers of cello master service Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. +``` diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 000000000..c5ab3414b --- /dev/null +++ b/docs/contributing.md @@ -0,0 +1,106 @@ +[//]: # "SPDX-License-Identifier: CC-BY-4.0" + +Any kind of contribution is encouraged, e.g., [Jira items](https://jira.hyperledger.org/projects/CE/issues) or [patchsets](https://github.com/hyperledger/cello). + +## 1. LF ID Application + +All the tools require an Linux Foundation (LF) ID. + +If you do not have an LF ID, [here is how to get one](https://wiki.hyperledger.org/display/CA/Setting+up+an+LFID). + +## 2. Jira board usage + +We are using [Jira](https://jira.hyperledger.org/projects/CE) to track the project progress, and welcome to report bug issues or create to-do tasks there. Each item should try keeping simple and focused, hence easy to fix and review. + +After login with your LF ID, you can see those task items with one of the following statuses: + +- `To Do`: Available for picking and fix. +- `In Progress`: Some on already picked it (check the assignee) to work on. +- `Under Review`: Related patchset has been submitted for review, and added as comment under the Jira item. +- `Done`: Patchset merged, the item has been resolved. + +In brief, if you want to contribute, create or find some `To Do` item, and assign it to yourself, then update its status to `In Progress`. After the item is fixed, remember to mark it as `Under Review` and `Done` when the patch is submitted and merged. + +## 3. Questions and discussions + +- [Chat](https://discord.gg/hyperledger): technical discussions and questions + +## 4. Code Commit Steps + +The project employs [GitHub](https://github.com/hyperledger/cello) as the code commit/review system. + +- Before committing code, please go to [Jira](https://jira.hyperledger.org/projects/CE) to create a new task or check if there's related existing one, then assign yourself as the assignee. Notice each task will get a Jira number like [CE-26](https://jira.hyperledger.org/browse/CE-26). + +- Clone the project to your working directory. + +```bash +$ git clone git@github.com:hyperledger/cello.git +``` + +(Optionally) Config your git name and email if not setup previously. + +```bash +$ git config user.name "your name" +$ git config user.email "your email" +``` + +- Assign yourself a `To Do` Jira task, mark it as `In progress`, then create a branch with the Jira task number off of your cloned repository, e.g., for CE-26, it can be: + +```bash +$ cd cello +$ git checkout -b CE-26 +``` + +- After modifying the code, run `make check` to make sure all the checking is passed. Then Commit your code with `-s` to sign-off, and `-a` to automatically add changes (or run `git add .` to include all changes manually). + +```bash +$ make check + ... + py27: commands succeeded + py30: commands succeeded + py35: commands succeeded + flake8: commands succeeded + congratulations :) + +$ git commit -s -a +``` + +Example commit msg may look like (take CE-1234 for example): + +```bash +[CE-1234] A short description of your change with no period at the end + +You can add more details here in several paragraphs, but please keep each line +width less than 80 characters. A bug fix should include the issue number. + +CE-1234 #done. + +Signed-off-by: Your Name +``` + +- Submit your PR using [hub](https://github.com/github/hub/), and mark the + corresponding Jira item as `Under Review`. + +```bash +docs % git push ryjones +Enumerating objects: 7, done. +Counting objects: 100% (7/7), done. +Delta compression using up to 4 threads +Compressing objects: 100% (4/4), done. +Writing objects: 100% (4/4), 835 bytes | 835.00 KiB/s, done. +Total 4 (delta 3), reused 0 (delta 0), pack-reused 0 +remote: Resolving deltas: 100% (3/3), completed with 3 local objects. +To github.com:ryjones/cello.git + 90f0d2e..ec42e8a master -> master +docs % hub pull-request +https://github.com/hyperledger/cello/pull/145 +docs % +``` + +Notice you will get a GitHub PR url like `https://github.com/hyperledger/cello/pull/145`, open it and check the status. + +After the ci checking passed, add [reviewers](https://wiki.hyperledger.org/projects/cello#contributors) to the reviewer list and also post the GitHub PR url in the chat channel. The patch will be merged into the `master` branch after passing the review, then mark the Jira item as `Done`. + +- If you need to refine the patch further as the reviewers may suggest, you can change on the same branch, and commit the new code with `git commit -a --amend`, and then use the `git review` command again. + +Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/docs/requirements.txt b/docs/requirements.txt index 500a51318..d575fb400 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,3 @@ -mkdocs>=1.0.4 +mkdocs>= 1.4.2 mkdocs-material>=4.4.0 -pygments>=2.4.2 -pymdown-extensions>=6.0 +pygments>=2.14.0 diff --git a/mkdocs.yml b/mkdocs.yml index fdba557fd..723f9bf78 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,18 +1,18 @@ site_name: Hyperledger Cello -repo_name: 'hyperledger/cello' -repo_url: 'https://github.com/hyperledger/cello' +repo_name: "hyperledger/cello" +repo_url: "https://github.com/hyperledger/cello" theme: - name: 'material' - logo: 'images/favicon.png' - favicon: 'images/favicon.png' - feature: - tabs: true - palette: - primary: 'light-blue' - accent: 'light-blue' - font: - text: 'Ubuntu' - code: 'Ubuntu Mono' + name: "mkdocs" + logo: "images/favicon.png" + favicon: "images/favicon.png" + feature: + tabs: true + palette: + primary: "light-blue" + accent: "light-blue" + font: + text: "Ubuntu" + code: "Ubuntu Mono" markdown_extensions: - admonition - codehilite @@ -24,49 +24,34 @@ markdown_extensions: - markdown.extensions.meta - markdown.extensions.toc: permalink: true - - pymdownx.arithmatex - - pymdownx.betterem: - smart_enable: all - - pymdownx.caret - - pymdownx.critic - - pymdownx.details - - pymdownx.inlinehilite - - pymdownx.keys - - pymdownx.magiclink - - pymdownx.mark - - pymdownx.smartsymbols - - pymdownx.superfences - - pymdownx.tasklist: - custom_checkbox: true - - pymdownx.tilde docs_dir: docs nav: - - Docs: - - Overview: index.md - - Concepts: concepts.md - - Design: - - Architecture: design/arch.md - - Setup: - - Server: setup/server.md - - Agent: - - Kubernetes: agents/kubernetes.md - - Ansible: agents/ansible.md - - Operations: - - Dashboard: - - Operator operations: operations/dashboard/operator.md - - Admin operations: operations/dashboard/admin.md - - User operations: operations/dashboard/user.md - - Reference: - - Configuration: - - Server Configuration: reference/configuration/server.md - - Commands: - - make: reference/commands/make.md - - cli: reference/commands/cli.md - - Contribute: contributing.md - - FAQ: - - faq.md - - Release Notes: - - release_note.md + - Docs: + - Overview: index.md + - Concepts: concepts.md + - Design: + - Architecture: design/arch.md + - Setup: + - Server: setup/server.md + - Agent: + - Kubernetes: agents/kubernetes.md + - Fabric operator: agents/fabric-operator.md + - Operations: + - Dashboard: + - Operator operations: operations/dashboard/operator.md + - Admin operations: operations/dashboard/admin.md + - User operations: operations/dashboard/user.md + - Reference: + - Configuration: + - Server Configuration: reference/configuration/server.md + - Commands: + - make: reference/commands/make.md + - cli: reference/commands/cli.md + - Contribute: contributing.md + - FAQ: + - faq.md + - Release Notes: + - release_note.md #plugins: # - search # - minify: diff --git a/scripts/master_node/download_images.sh b/scripts/master_node/download_images.sh old mode 100644 new mode 100755 index 1cc628b6b..8cea89039 --- a/scripts/master_node/download_images.sh +++ b/scripts/master_node/download_images.sh @@ -24,37 +24,36 @@ else fi ARCH=$(uname -m) -VERSION="${VERSION:-latest}" +VERSION="latest" +PIP=pip.conf.bak echo_b "Downloading the docker images for Cello services: VERSION=${VERSION} ARCH=${ARCH}" -# TODO: will be removed after we have the user dashboard image -echo_b "Check node:9.2 image." -[ -z "$(docker images -q node:9.2 2> /dev/null)" ] && { echo "pulling node:9.2"; docker pull node:9.2; } - # docker image -for IMG in dashboard nginx api-engine; do +for IMG in dashboard api-engine; do HLC_IMG=hyperledger/cello-${IMG} - #if [ -z "$(docker images -q ${HLC_IMG}:${ARCH}-${VERSION} 2> /dev/null)" ]; then # not exist - echo_b "Pulling ${HLC_IMG}:${ARCH}-${VERSION} from dockerhub" - docker pull ${HLC_IMG}:${ARCH}-${VERSION} - docker tag ${HLC_IMG}:${ARCH}-${VERSION} ${HLC_IMG} # match the docker-compose file - #else - # echo_g "${HLC_IMG} already exist locally" - #fi + PATH=build_image/docker/common/${IMG}/Dockerfile.in + if [ -z "$(docker images -q ${HLC_IMG}:latest 2> /dev/null)" ]; then # not exist + echo_b "Build ${HLC_IMG} locally" + docker build -t ${HLC_IMG}:latest -f ${PATH} ./ --build-arg pip=${PIP} --platform linux/${ARCH} + #hyperledger/cello-:latest -f build_image/docker/common/api-engine/Dockerfile.in ./ --platform linux/$(ARCH); \ + # docker tag ${HLC_IMG}:${ARCH}-${VERSION} ${HLC_IMG} # match the docker-compose file + else + echo_g "${HLC_IMG} already exist locally" + fi done # We now use official images instead of customized one -docker pull mongo:3.4.10 +# docker pull mongo:3.4.10 # NFS service -docker pull itsthenetwork/nfs-server-alpine:9 +# docker pull itsthenetwork/nfs-server-alpine:9 # Database server -docker pull mariadb:10.3.10 +# docker pull mariadb:10.3.10 # Keycloak is help access the database -docker pull jboss/keycloak:4.5.0.Final +# docker pull jboss/keycloak:4.5.0.Final echo_g "All Image downloaded " diff --git a/scripts/master_node/setup.sh b/scripts/master_node/setup.sh index 799d0f7db..6899e1df0 100755 --- a/scripts/master_node/setup.sh +++ b/scripts/master_node/setup.sh @@ -47,7 +47,7 @@ get_distribution() { USER=`whoami` DISTRO=$(get_distribution) -DB_DIR=/opt/${PROJECT}/mongo +DB_DIR=/opt/${PROJECT}/postgres echo_b "user: ${USER}, distro: ${DISTRO}, db_dir: ${DB_DIR}" echo_b "It is recommended to use Ubuntu 18.04 OS." @@ -128,7 +128,7 @@ fi echo_b "Download required Docker images for Cello Services..." bash ./download_images.sh -echo_b "Checking local storage path ${DB_DIR}, which will be mounted to Workers later..." +echo_b "Checking local storage path ${DB_DIR}, which will be mounted to API engine service later..." [ ! -d ${DB_DIR} ] \ && echo_r "Local database path ${DB_DIR} not existed, creating one" \ && sudo mkdir -p ${DB_DIR} \ diff --git a/scripts/worker_node/download_images.sh b/scripts/worker_node/download_images.sh index d710c7505..20d3f628b 100755 --- a/scripts/worker_node/download_images.sh +++ b/scripts/worker_node/download_images.sh @@ -48,54 +48,61 @@ if [ $ARCH_1_2 = "x86_64" ];then ARCH_1_2="amd64" fi -function downloadImages() { - ARCH=$1 - IMG_TAG=$2 - BASEIMAGE_RELEASE=$3 - HLF_VERSION=$4 +# function downloadImages() { +# ARCH=$1 +# IMG_TAG=$2 +# BASEIMAGE_RELEASE=$3 +# HLF_VERSION=$4 - echo_b "Downloading fabric images from DockerHub...with tag = ${IMG_TAG}... need a while" - # TODO: we may need some checking on pulling result? - for IMG in peer tools orderer ca ccenv; do - HLF_IMG=hyperledger/fabric-${IMG}:$ARCH-$IMG_TAG - if [ -z "$(docker images -q ${HLF_IMG} 2> /dev/null)" ]; then # not exist - docker pull ${HLF_IMG} - else - echo_g "${HLF_IMG} already exist locally" - fi - done +# echo_b "Downloading fabric images from DockerHub...with tag = ${IMG_TAG}... need a while" +# # TODO: we may need some checking on pulling result? +# for IMG in peer tools orderer ca ccenv; do +# HLF_IMG=hyperledger/fabric-${IMG}:$ARCH-$IMG_TAG +# if [ -z "$(docker images -q ${HLF_IMG} 2> /dev/null)" ]; then # not exist +# docker pull ${HLF_IMG} +# else +# echo_g "${HLF_IMG} already exist locally" +# fi +# done - HLF_IMG=hyperledger/fabric-baseimage:$ARCH-$BASEIMAGE_RELEASE - [ -z "$(docker images -q ${HLF_IMG} 2> /dev/null)" ] && docker pull ${HLF_IMG} - HLF_IMG=hyperledger/fabric-baseos:$ARCH-$BASEIMAGE_RELEASE - [ -z "$(docker images -q ${HLF_IMG} 2> /dev/null)" ] && docker pull ${HLF_IMG} +# HLF_IMG=hyperledger/fabric-baseimage:$ARCH-$BASEIMAGE_RELEASE +# [ -z "$(docker images -q ${HLF_IMG} 2> /dev/null)" ] && docker pull ${HLF_IMG} +# HLF_IMG=hyperledger/fabric-baseos:$ARCH-$BASEIMAGE_RELEASE +# [ -z "$(docker images -q ${HLF_IMG} 2> /dev/null)" ] && docker pull ${HLF_IMG} - # Only useful for debugging - # docker pull yeasy/hyperledger-fabric +# # Only useful for debugging +# # docker pull yeasy/hyperledger-fabric - echo_b "===Re-tagging fabric images to *:${HLF_VERSION}* tag" - for IMG in peer tools orderer ca; do - HLF_IMG=hyperledger/fabric-${IMG} - docker tag ${HLF_IMG}:$ARCH-$IMG_TAG ${HLF_IMG}:${HLF_VERSION} - done +# echo_b "===Re-tagging fabric images to *:${HLF_VERSION}* tag" +# for IMG in peer tools orderer ca; do +# HLF_IMG=hyperledger/fabric-${IMG} +# docker tag ${HLF_IMG}:$ARCH-$IMG_TAG ${HLF_IMG}:${HLF_VERSION} +# done - IMG_TAG=$5 - echo_b "Downloading and retag images for kafka/zookeeper separately, as their img_tag format is different" - for IMG in kafka zookeeper couchdb; do - HLF_IMG=hyperledger/fabric-${IMG} - if [ -z "$(docker images -q ${HLF_IMG}:${HLF_VERSION} 2> /dev/null)" ]; then # not exist - docker pull ${HLF_IMG}:$ARCH-$IMG_TAG - docker tag ${HLF_IMG}:$ARCH-$IMG_TAG ${HLF_IMG}:${HLF_VERSION} - else - echo_g "${HLF_IMG}:$ARCH-$IMG_TAG already exist locally" - fi - done - echo_g "Done, now worker node should have all required images, use 'docker images' to check" -} +# IMG_TAG=$5 +# echo_b "Downloading and retag images for kafka/zookeeper separately, as their img_tag format is different" +# for IMG in kafka zookeeper couchdb; do +# HLF_IMG=hyperledger/fabric-${IMG} +# if [ -z "$(docker images -q ${HLF_IMG}:${HLF_VERSION} 2> /dev/null)" ]; then # not exist +# docker pull ${HLF_IMG}:$ARCH-$IMG_TAG +# docker tag ${HLF_IMG}:$ARCH-$IMG_TAG ${HLF_IMG}:${HLF_VERSION} +# else +# echo_g "${HLF_IMG}:$ARCH-$IMG_TAG already exist locally" +# fi +# done +# echo_g "Done, now worker node should have all required images, use 'docker images' to check" +# } -downloadImages $ARCH_1_0 $IMG_TAG_1_0 $BASEIMAGE_RELEASE_1_0 $HLF_VERSION_1_0 $IMG_TAG_1_0 #kafka and zookeeper have the same IMG_TAG as peer in 1.0 -downloadImages $ARCH_1_1 $IMG_TAG_1_1 $BASEIMAGE_RELEASE_1_1 $HLF_VERSION_1_1 $BASEIMAGE_RELEASE_1_1 #kafka and zookeeper have the same IMG_TAG as baseimage in 1.1 -downloadImages $ARCH_1_2 $IMG_TAG_1_2 $BASEIMAGE_RELEASE_1_2 $HLF_VERSION_1_2 $BASEIMAGE_RELEASE_1_2 #kafka and zookeeper have the same IMG_TAG as baseimage in 1.2 +# downloadImages $ARCH_1_0 $IMG_TAG_1_0 $BASEIMAGE_RELEASE_1_0 $HLF_VERSION_1_0 $IMG_TAG_1_0 #kafka and zookeeper have the same IMG_TAG as peer in 1.0 +# downloadImages $ARCH_1_1 $IMG_TAG_1_1 $BASEIMAGE_RELEASE_1_1 $HLF_VERSION_1_1 $BASEIMAGE_RELEASE_1_1 #kafka and zookeeper have the same IMG_TAG as baseimage in 1.1 +# downloadImages $ARCH_1_2 $IMG_TAG_1_2 $BASEIMAGE_RELEASE_1_2 $HLF_VERSION_1_2 $BASEIMAGE_RELEASE_1_2 #kafka and zookeeper have the same IMG_TAG as baseimage in 1.2 +echo_b "Downloading fabric images from DockerHub...with tag = ${IMG_TAG}... need a while" +HLF_IMG=yeasy/hyperledger-fabric:2.2.0 +if [ -z "$(docker images -q ${HLF_IMG} 2> /dev/null)" ]; then # not exist + docker pull ${HLF_IMG} +else + echo_g "${HLF_IMG} already exist locally" +fi # Used by explorer -docker pull mysql:5.7 +# docker pull mysql:5.7