2017-10-05 23:21:54 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-04-01 11:10:38 +08:00
|
|
|
# peer/orderer/ca/ccenv/tools/javaenv/baseos: 1.4, 1.4.0, 1.4.1, 2.0.0, latest
|
2020-01-30 02:49:24 +08:00
|
|
|
# baseimage (runtime for golang chaincode) and couchdb: 0.4.18, latest
|
2019-04-01 11:10:38 +08:00
|
|
|
|
|
|
|
# In core.yaml, it requires:
|
2020-01-30 02:49:24 +08:00
|
|
|
# * fabric-ccenv:$(TWO_DIGIT_VERSION)
|
|
|
|
# * fabric-baseos:$(TWO_DIGIT_VERSION)
|
|
|
|
# * fabric-javaenv:$(TWO_DIGIT_VERSION)
|
|
|
|
# * fabric-nodeenv:$(TWO_DIGIT_VERSION)
|
2019-04-01 11:10:38 +08:00
|
|
|
|
2018-02-08 21:23:37 +08:00
|
|
|
# Define those global variables
|
|
|
|
if [ -f ./variables.sh ]; then
|
|
|
|
source ./variables.sh
|
|
|
|
elif [ -f scripts/variables.sh ]; then
|
|
|
|
source scripts/variables.sh
|
|
|
|
else
|
|
|
|
echo_r "Cannot find the variables.sh files, pls check"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-10-02 08:41:08 +08:00
|
|
|
# pull_image image_name <true|false (default)>
|
2018-02-08 21:23:37 +08:00
|
|
|
pull_image() {
|
|
|
|
IMG=$1
|
2019-10-02 08:41:08 +08:00
|
|
|
FORCED="false"
|
|
|
|
if [ "$#" -eq 2 ]; then
|
|
|
|
FORCED=$2
|
|
|
|
fi
|
|
|
|
if [ ! -z "$(docker images -q ${IMG} 2> /dev/null)" ] && [ "$FORCED" != "true" ]; then # existed and not forced to update
|
|
|
|
echo "${IMG} already exists and not forced to update "
|
|
|
|
else
|
|
|
|
docker pull ${IMG}
|
|
|
|
fi
|
2018-02-08 21:23:37 +08:00
|
|
|
}
|
2017-10-05 23:21:54 +08:00
|
|
|
|
2018-01-30 15:54:49 +08:00
|
|
|
echo "Downloading images from DockerHub... need a while"
|
|
|
|
|
2017-10-05 23:21:54 +08:00
|
|
|
# TODO: we may need some checking on pulling result?
|
2019-04-01 11:10:38 +08:00
|
|
|
echo "=== Pulling yeasy/hyperledger-fabric-* images with tag ${FABRIC_IMG_TAG}... ==="
|
2018-02-08 21:23:37 +08:00
|
|
|
for IMG in base peer orderer ca; do
|
2019-10-02 08:41:08 +08:00
|
|
|
pull_image "yeasy/hyperledger-fabric-${IMG}:$FABRIC_IMG_TAG" "true" &
|
2018-02-08 21:23:37 +08:00
|
|
|
done
|
2019-07-20 02:41:57 +08:00
|
|
|
|
2019-12-28 09:43:08 +08:00
|
|
|
pull_image yeasy/hyperledger-fabric:$FABRIC_IMG_TAG "true"
|
2018-03-05 13:53:21 +08:00
|
|
|
|
2019-04-01 11:10:38 +08:00
|
|
|
# pull_image yeasy/blockchain-explorer:0.1.0-preview # TODO: wait for official images
|
|
|
|
echo "=== Pulling fabric core images ${FABRIC_IMG_TAG} from fabric repo... ==="
|
2020-01-30 02:49:24 +08:00
|
|
|
for IMG in peer orderer ca tools; do
|
2019-12-28 09:43:08 +08:00
|
|
|
pull_image hyperledger/fabric-${IMG}:$FABRIC_IMG_TAG & # e.g., v2.0.0
|
2018-02-08 21:23:37 +08:00
|
|
|
done
|
2019-05-24 12:29:27 +08:00
|
|
|
|
2020-01-30 02:49:24 +08:00
|
|
|
echo "=== Pulling fabric chaincode images ${TWO_DIGIT_VERSION} from fabric repo... ==="
|
|
|
|
for IMG in ccenv baseos javaenv nodeenv; do
|
|
|
|
pull_image hyperledger/fabric-${IMG}:${TWO_DIGIT_VERSION} & # e.g., v2.0
|
|
|
|
done
|
|
|
|
|
2019-05-24 12:29:27 +08:00
|
|
|
echo "=== Pulling base/3rd-party images with tag ${BASE_IMG_TAG} from fabric repo... ==="
|
|
|
|
for IMG in baseimage couchdb kafka zookeeper; do
|
|
|
|
pull_image hyperledger/fabric-${IMG}:$BASE_IMG_TAG &
|
|
|
|
done
|
|
|
|
|
2020-01-30 02:49:24 +08:00
|
|
|
# TODO: dockerhub fabric-ccenv:2.0 image is too old
|
2019-10-09 03:13:17 +08:00
|
|
|
# Hence we need to build the image locally and tag it manually
|
2020-01-30 02:49:24 +08:00
|
|
|
docker tag yeasy/hyperledger-fabric-base hyperledger/fabric-ccenv:${TWO_DIGIT_VERSION}
|
2017-10-05 23:21:54 +08:00
|
|
|
|
2019-10-09 03:13:17 +08:00
|
|
|
echo "Image pulling done, now can startup the network using make start..."
|
|
|
|
exit 0
|