Minor fix

pull/108/head
Baohua Yang 2017-12-06 22:33:08 +08:00
parent 8d4b551fc1
commit a5a0ef47fa
3 changed files with 43 additions and 17 deletions

View File

@ -23,7 +23,7 @@ elif [ -f scripts/func.sh ]; then
source scripts/func.sh
fi
echo_b "Generating artifacts in ${MODE}"
echo_b "Generating artifacts for ${MODE}"
echo_b "Clean existing container $GEN_CONTAINER"
[ "$(docker ps -a | grep $GEN_CONTAINER)" ] && docker rm -f $GEN_CONTAINER
@ -31,22 +31,45 @@ echo_b "Clean existing container $GEN_CONTAINER"
pushd ${MODE}
echo_b "Check whether channel-artifacts or crypto-config exist already"
[ -d ${CRYPTO_CONFIG} ] && echo "${CRYPTO_CONFIG} existed, will stop generating new configs" && exit 0
GEN_CRYPTO=true
if [ -d ${CRYPTO_CONFIG} ]; then #already exist, no need to re-gen crypto
echo_b "${CRYPTO_CONFIG} existed, won't regenerate it."
GEN_CRYPTO=false
else
mkdir ${CRYPTO_CONFIG}
[ -d ${CHANNEL_ARTIFACTS} ] && echo "${CHANNEL_ARTIFACTS} existed, will stop generating new configs" && exit 0
fi
GEN_ARTIFACTS=true
if [ -d ${CHANNEL_ARTIFACTS} ]; then
echo_b "${CHANNEL_ARTIFACTS} existed, won't regenerate it."
GEN_ARTIFACTS=false
else
mkdir ${CHANNEL_ARTIFACTS}
fi
if [ "${GEN_CRYPTO}" = "false" -a "${GEN_ARTIFACTS}" = "false" ]; then
echo_g "No need to generate new config, exiting..."
exit 0
fi
echo_b "Starting container $GEN_CONTAINER in background"
docker run \
-d -it \
--name $GEN_CONTAINER \
-e "CONFIGTX_LOGGING_LEVEL=DEBUG" \
-e "CONFIGTX_LOGGING_FORMAT=%{color}[%{id:03x} %{time:01-02 15:04:05.00 MST}] [%{longpkg}] %{callpath} -> %{level:.4s}%{color:reset} %{message}" \
-v $PWD/configtx.yaml:${FABRIC_CFG_PATH}/configtx.yaml \
-v $PWD/crypto-config.yaml:${FABRIC_CFG_PATH}/crypto-config.yaml \
-v $PWD/${CRYPTO_CONFIG}:${FABRIC_CFG_PATH}/${CRYPTO_CONFIG} \
-v $PWD/${CHANNEL_ARTIFACTS}:/tmp/${CHANNEL_ARTIFACTS} \
$GEN_IMG bash -c 'while true; do sleep 20171001; done'
${GEN_IMG} bash -c 'while true; do sleep 20171001; done'
if [ "${GEN_CRYPTO}" = "true" ]; then
echo_b "Generating crypto-config"
con_exec cryptogen generate --config=$FABRIC_CFG_PATH/crypto-config.yaml --output ${FABRIC_CFG_PATH}/crypto-config
fi
if [ "${GEN_ARTIFACTS}" = "true" ]; then
echo_b "Generate genesis block file for system channel using configtx.yaml"
con_exec configtxgen -profile TwoOrgsOrdererGenesis -outputBlock /tmp/${CHANNEL_ARTIFACTS}/${ORDERER_GENESIS}
@ -56,7 +79,9 @@ con_exec configtxgen -profile TwoOrgsChannel -outputCreateChannelTx /tmp/$CHANNE
echo_b "Create the anchor peer configuration tx using configtx.yaml"
con_exec configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate /tmp/${CHANNEL_ARTIFACTS}/Org1MSPanchors.tx -channelID ${APP_CHANNEL} -asOrg Org1MSP
con_exec configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate /tmp/${CHANNEL_ARTIFACTS}/Org2MSPanchors.tx -channelID ${APP_CHANNEL} -asOrg Org2MSP
fi
echo_b "Remove the container $GEN_CONTAINER" && docker rm -f $GEN_CONTAINER
echo_g "Generated artifacts in ${MODE}"
echo_g "Generated artifacts for ${MODE}"

View File

@ -60,4 +60,4 @@ fi
echo_b "Stop configtxlator service"
docker rm -f $CTL_CONTAINER
echo_g "Test configtxlator on $MODE Passed"
echo_g "Test configtxlator for $MODE Passed"

View File

@ -183,6 +183,7 @@ download: # download required images
docker pull hyperledger/fabric-zookeeper:x86_64-1.1.0-preview
docker pull hyperledger/fabric-kafka:x86_64-1.1.0-preview
docker pull hyperledger/fabric-couchdb:x86_64-1.1.0-preview
docker pull hyperledger/fabric-ccenv:x86_64-1.1.0-preview
docker tag yeasy/hyperledger-fabric-peer:latest hyperledger/fabric-ccenv:x86_64-1.1.0
################## chaincode dev mode ################