diff --git a/docs/installation.md b/docs/installation.md index f1dd60889..4ae234784 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -76,7 +76,17 @@ At last, run the follow test at Master node and get OK response, to make sure it ``` ### Docker Images Pulling -Pulling the following images. +Pulling the necessary images. + +#### Fabric v1.0 + +```bash +$ cd scripts/worker_node_setup && bash download_images.sh +``` + +#### Fabric v0.6 (TODO: deprecated soon) + +For fabric v0.6, need to run the following command. ```bash $ docker pull hyperledger/fabric-peer:x86_64-0.6.1-preview \ diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 000000000..05f910f81 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,7 @@ +# Scripts + +Here we collect scripts to help setup and manage the lifecycle of cello service. + +Most of them are needed by the master node. + +Those under [worker_node_setup](worker_node_setup) directory should be put at the worker node to help setup. diff --git a/scripts/worker_node_setup/download_images.sh b/scripts/worker_node_setup/download_images.sh new file mode 100644 index 000000000..78420b962 --- /dev/null +++ b/scripts/worker_node_setup/download_images.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + + +# Detecting whether can import the header file to render colorful cli output +if [ -f ./header.sh ]; then + source ./header.sh +elif [ -f worker_node_setup/header.sh ]; then + source worker_node_setup/header.sh +else + alias echo_r="echo" + alias echo_g="echo" + alias echo_b="echo" +fi + +ARCH=x86_64 +BASEIMAGE_RELEASE=0.3.1 +BASE_VERSION=1.0.0 +PROJECT_VERSION=1.0.0-preview + +IMG_VERSION=0.9.6 +# Only For testing latest images +IMG_VERSION=latest + +echo_b "Downloading images from DockerHub... need a while" + +# TODO: we may need some checking on pulling result? +docker pull yeasy/hyperledger-fabric-base:$IMG_VERSION \ + && docker pull yeasy/hyperledger-fabric-peer:$IMG_VERSION \ + && docker pull yeasy/hyperledger-fabric-orderer:$IMG_VERSION \ + && docker pull yeasy/hyperledger-fabric-ca:$IMG_VERSION + +# Only useful for debugging +# docker pull yeasy/hyperledger-fabric + +echo_b "Rename images with official tags ... fabric-peer, fabric-orderer, fabric-tools, fabric-ca, fabric-ccenv, fabric-bareos, fabric-baseimage" +docker tag yeasy/hyperledger-fabric-peer:$IMG_VERSION hyperledger/fabric-peer \ + && docker tag yeasy/hyperledger-fabric-peer:$IMG_VERSION hyperledger/fabric-tools \ + && docker tag yeasy/hyperledger-fabric-orderer:$IMG_VERSION hyperledger/fabric-orderer \ + && docker tag yeasy/hyperledger-fabric-ca:$IMG_VERSION hyperledger/fabric-ca \ + && docker tag yeasy/hyperledger-fabric-base:$IMG_VERSION hyperledger/fabric-ccenv:$ARCH-$PROJECT_VERSION \ + && docker tag yeasy/hyperledger-fabric-base:$IMG_VERSION hyperledger/fabric-baseos:$ARCH-$BASE_VERSION \ + && docker tag yeasy/hyperledger-fabric-base:$IMG_VERSION hyperledger/fabric-baseimage:$ARCH-$BASEIMAGE_RELEASE + +echo_g "Done, now worker node should have all images, use `docker images` to check" \ No newline at end of file diff --git a/scripts/worker_node_setup/header.sh b/scripts/worker_node_setup/header.sh new file mode 100644 index 000000000..7620a87ef --- /dev/null +++ b/scripts/worker_node_setup/header.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +## DO NOT MODIFY THE FOLLOWING PART, UNLESS YOU KNOW WHAT IT MEANS ## +echo_r () { + [ $# -ne 1 ] && return 0 + echo -e "\033[31m$1\033[0m" +} +echo_g () { + [ $# -ne 1 ] && return 0 + echo -e "\033[32m$1\033[0m" +} +echo_y () { + [ $# -ne 1 ] && return 0 + echo -e "\033[33m$1\033[0m" +} +echo_b () { + [ $# -ne 1 ] && return 0 + echo -e "\033[34m$1\033[0m" +} \ No newline at end of file diff --git a/scripts/worker_node_setup/setup_docker_worker_node.sh b/scripts/worker_node_setup/setup_docker_worker_node.sh index fd843866c..8b65eaa8f 100644 --- a/scripts/worker_node_setup/setup_docker_worker_node.sh +++ b/scripts/worker_node_setup/setup_docker_worker_node.sh @@ -1,8 +1,10 @@ +#!/usr/bin/env bash # Copyright IBM Corp, All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # + # This script will help setup Docker at a server, then the server can be used as a worker node. -# TODO: \ No newline at end of file +# TODO: diff --git a/scripts/worker_node_setup/setup_k8s_worker_node.sh b/scripts/worker_node_setup/setup_k8s_worker_node.sh index f516cbb7b..f46d0c8f3 100644 --- a/scripts/worker_node_setup/setup_k8s_worker_node.sh +++ b/scripts/worker_node_setup/setup_k8s_worker_node.sh @@ -1,8 +1,10 @@ +#!/usr/bin/env bash # Copyright IBM Corp, All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # + # This script will help setup a Kubernetes cluster at servers, then the cluster can be used as a worker node. -# TODO: \ No newline at end of file +# TODO: diff --git a/scripts/worker_node_setup/setup_swarm_worker_node.sh b/scripts/worker_node_setup/setup_swarm_worker_node.sh index d2ebba742..fd214b761 100644 --- a/scripts/worker_node_setup/setup_swarm_worker_node.sh +++ b/scripts/worker_node_setup/setup_swarm_worker_node.sh @@ -1,8 +1,10 @@ +#!/usr/bin/env bash # Copyright IBM Corp, All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # + # This script will help setup a Swarm cluster at servers, then the cluster can be used as a worker node. -# TODO: \ No newline at end of file +# TODO: