samplesInstall() { # clone (if needed) hyperledger/fabric-samples and checkout corresponding # version to the binaries and docker images to be downloaded if [ -d first-network ]; then # if we are in the fabric-samples repo, checkout corresponding version echo "===> Checking out v${VERSION} of hyperledger/fabric-samples" git checkout v${VERSION} elif [ -d fabric-samples ]; then # if fabric-samples repo already cloned and in current directory, # cd fabric-samples and checkout corresponding version echo "===> Checking out v${VERSION} of hyperledger/fabric-samples" cd fabric-samples && git checkout v${VERSION} else echo "===> Cloning hyperledger/fabric-samples repo and checkout v${VERSION}" git clone -b master https://github.com/hyperledger/fabric-samples.git && cd fabric-samples && git checkout v${VERSION} fi }
binariesInstall() { echo "===> Downloading version ${FABRIC_TAG} platform specific fabric binaries" binaryDownload "${BINARY_FILE}" "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/${BINARY_FILE}" if [ $? -eq 22 ]; then echo echo "------> ${FABRIC_TAG} platform specific fabric binary is not available to download <----" echo fi
echo "===> Downloading version ${CA_TAG} platform specific fabric-ca-client binary" binaryDownload "${CA_BINARY_FILE}" "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric-ca/hyperledger-fabric-ca/${ARCH}-${CA_VERSION}/${CA_BINARY_FILE}" if [ $? -eq 22 ]; then echo echo "------> ${CA_TAG} fabric-ca-client binary is not available to download (Available from 1.1.0-rc1) <----" echo fi }
# This will attempt to download the .tar.gz all at once, but will trigger the # binaryIncrementalDownload() function upon a failure, allowing for resume # if there are network failures. binaryDownload() { local BINARY_FILE=$1 local URL=$2 echo "===> Downloading: " "${URL}" # Check if a previous failure occurred and the file was partially downloaded if [ -e "${BINARY_FILE}" ]; then echo "==> Partial binary file found. Resuming download..." binaryIncrementalDownload "${BINARY_FILE}" "${URL}" else curl "${URL}" | tar xz || rc=$? if [ -n "$rc" ]; then echo "==> There was an error downloading the binary file. Switching to incremental download." echo "==> Downloading file..." binaryIncrementalDownload "${BINARY_FILE}" "${URL}" else echo "==> Done." fi fi }
# dockerFabricPull() pulls docker images from fabric and chaincode repositories # note, if a docker image doesn't exist for a requested release, it will simply # be skipped, since this script doesn't terminate upon errors. dockerFabricPull() { local FABRIC_TAG=$1 for IMAGES in peer orderer ccenv tools baseos nodeenv javaenv; do echo "==> FABRIC IMAGE: $IMAGES" echo docker pull "hyperledger/fabric-$IMAGES:$FABRIC_TAG" docker tag "hyperledger/fabric-$IMAGES:$FABRIC_TAG" "hyperledger/fabric-$IMAGES" done }
2.3.2 dockerCaPull
1 2 3 4 5 6 7
dockerCaPull() { local CA_TAG=$1 echo "==> FABRIC CA IMAGE" echo docker pull "hyperledger/fabric-ca:$CA_TAG" docker tag "hyperledger/fabric-ca:$CA_TAG" "hyperledger/fabric-ca" }
2.3.3 dockerThirdPartyImagesPull
1 2 3 4 5 6 7 8 9 10
dockerThirdPartyImagesPull() { local THIRDPARTY_TAG=$1 for IMAGES in couchdb kafka zookeeper; do echo "==> THIRDPARTY DOCKER IMAGE: $IMAGES" echo docker pull "hyperledger/fabric-$IMAGES:$THIRDPARTY_TAG" docker tag "hyperledger/fabric-$IMAGES:$THIRDPARTY_TAG" "hyperledger/fabric-$IMAGES" done }