From 03356342b4fd8b68f0a868b3ea1347bd2591c50a Mon Sep 17 00:00:00 2001 From: sapthasurendran Date: Fri, 10 Dec 2021 20:01:01 +0530 Subject: [PATCH] docker container cleanup and script changes Signed-off-by: sapthasurendran --- fabric-network/bin/.gitignore | 1 + .../docker/docker-compose-new-orderer.yaml | 3 ++- .../scripts/addNewOrderer.sh | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/fabric-network/bin/.gitignore b/fabric-network/bin/.gitignore index 036b57c..58ce5da 100644 --- a/fabric-network/bin/.gitignore +++ b/fabric-network/bin/.gitignore @@ -8,3 +8,4 @@ idemixgen orderer osnadmin fabric-ca-server +ledgerutil \ No newline at end of file diff --git a/fabric-network/docker-based-syschannel/docker/docker-compose-new-orderer.yaml b/fabric-network/docker-based-syschannel/docker/docker-compose-new-orderer.yaml index 07c73e0..6f9aa14 100644 --- a/fabric-network/docker-based-syschannel/docker/docker-compose-new-orderer.yaml +++ b/fabric-network/docker-based-syschannel/docker/docker-compose-new-orderer.yaml @@ -39,9 +39,10 @@ services: working_dir: /opt/gopath/src/github.com/hyperledger/fabric command: orderer volumes: - - ../system-genesis-block/genesis.block:/var/hyperledger/orderer/orderer.genesis.block + - ../channel-artifacts/latest_config.block:/var/hyperledger/orderer/orderer.genesis.block - ../organizations/ordererOrganizations/example.com/orderers/orderer6.example.com/msp:/var/hyperledger/orderer/msp - ../organizations/ordererOrganizations/example.com/orderers/orderer6.example.com/tls/:/var/hyperledger/orderer/tls + ports: - 7056:7056 - 17056:17056 diff --git a/fabric-network/docker-based-syschannel/scripts/addNewOrderer.sh b/fabric-network/docker-based-syschannel/scripts/addNewOrderer.sh index a55f054..e28b5af 100755 --- a/fabric-network/docker-based-syschannel/scripts/addNewOrderer.sh +++ b/fabric-network/docker-based-syschannel/scripts/addNewOrderer.sh @@ -58,7 +58,7 @@ fetchChannelConfig() { setOrderer $ORG export FABRIC_CFG_PATH=$PWD/../config/ - echo '--------------------' $ORDERER + infoln "$(timestamp) Fetching the most recent configuration block for the channel ${CHANNEL}" set -x @@ -161,7 +161,17 @@ submitConfigUpdateTransaction(){ { set +x; } 2>/dev/null infoln " $(timestamp) Submit config update process done" } +fetchConfigBlock(){ + + infoln "Fetch latest block from channel ${2}" + ORG=$1 + CHANNEL=$2 + setOrderer $ORG + peer channel fetch config channel-artifacts/latest_config.block -o localhost:7050 --ordererTLSHostnameOverride orderer1.example.com -c ${CHANNEL} --tls --cafile $ORDERER + docker cp cli:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts/latest_config.block ./channel-artifacts/latest_config.block + +} # generate crypto for new orderer generateOrdererCrypto @@ -189,6 +199,10 @@ submitConfigUpdateTransaction 1 'system-channel' 'neworderer_endpoint_config_upd +# fetch latest block and move to channel artifacts +fetchConfigBlock 1 'system-channel' + + # start new orderer container startNewOrderer