Skip to content

Commit

Permalink
[FAB-12724] Upgrade from 1.3.x to 1.4.0
Browse files Browse the repository at this point in the history
Adding support to upgrade from 1.3.x to 1.4.0 using upgrade_to_v14.sh
and changes to byfn.sh

For this, no v1_4 capabilities need to be enabled other than v1_3
capabilities on channel and application group level

Only upgrading the images from v1.3.x to v.1.4.0 for peer, orderer,
cli, ccenv

Change-Id: I991f96c2deb3c91870ec4654aa8b561f49594248
Signed-off-by: Surya Lanka <suryalnvs@gmail.com>
  • Loading branch information
suryalnvs committed Dec 7, 2018
1 parent 33f064f commit e1a39e6
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 171 deletions.
14 changes: 7 additions & 7 deletions first-network/byfn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function printHelp() {
echo " - 'down' - clear the network with docker-compose down"
echo " - 'restart' - restart the network"
echo " - 'generate' - generate required certificates and genesis block"
echo " - 'upgrade' - upgrade the network from version 1.2.x to 1.3.x"
echo " - 'upgrade' - upgrade the network from version 1.3.x to 1.4.0"
echo " -c <channel name> - channel name to use (defaults to \"mychannel\")"
echo " -t <timeout> - CLI timeout duration in seconds (defaults to 10)"
echo " -d <delay> - delay duration in seconds (defaults to 3)"
Expand All @@ -57,7 +57,7 @@ function printHelp() {
echo
echo " byfn.sh generate -c mychannel"
echo " byfn.sh up -c mychannel -s couchdb"
echo " byfn.sh up -c mychannel -s couchdb -i 1.2.x"
echo " byfn.sh up -c mychannel -s couchdb -i 1.4.0"
echo " byfn.sh up -l node"
echo " byfn.sh down -c mychannel"
echo " byfn.sh upgrade -c mychannel"
Expand Down Expand Up @@ -172,14 +172,14 @@ function networkUp() {
fi
}

# Upgrade the network components which are at version 1.2.x to 1.3.x
# Upgrade the network components which are at version 1.3.x to 1.4.x
# Stop the orderer and peers, backup the ledger for orderer and peers, cleanup chaincode containers and images
# and relaunch the orderer and peers with latest tag
function upgradeNetwork() {
if [[ "$IMAGETAG" == *"1.3"* ]] || [[ $IMAGETAG == "latest" ]]; then
if [[ "$IMAGETAG" == *"1.4"* ]] || [[ $IMAGETAG == "latest" ]]; then
docker inspect -f '{{.Config.Volumes}}' orderer.example.com | grep -q '/var/hyperledger/production/orderer'
if [ $? -ne 0 ]; then
echo "ERROR !!!! This network does not appear to be using volumes for its ledgers, did you start from fabric-samples >= v1.2.x?"
echo "ERROR !!!! This network does not appear to start with fabric-samples >= v1.3.x?"
exit 1
fi

Expand Down Expand Up @@ -225,13 +225,13 @@ function upgradeNetwork() {
docker-compose $COMPOSE_FILES up -d --no-deps $PEER
done

docker exec cli scripts/upgrade_to_v13.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE
docker exec cli scripts/upgrade_to_v14.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE
if [ $? -ne 0 ]; then
echo "ERROR !!!! Test failed"
exit 1
fi
else
echo "ERROR !!!! Pass the v1.3.x image tag"
echo "ERROR !!!! Pass the v1.4.x image tag"
fi
}

Expand Down
2 changes: 2 additions & 0 deletions first-network/configtx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ Application: &ApplicationDefaults
Type: ImplicitMeta
Rule: "MAJORITY Admins"

Capabilities:
<<: *ApplicationCapabilities
################################################################################
#
# SECTION: Orderer
Expand Down
9 changes: 0 additions & 9 deletions first-network/scripts/capabilities.json

This file was deleted.

155 changes: 0 additions & 155 deletions first-network/scripts/upgrade_to_v13.sh

This file was deleted.

66 changes: 66 additions & 0 deletions first-network/scripts/upgrade_to_v14.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

echo
echo " ____ _____ _ ____ _____ "
echo "/ ___| |_ _| / \ | _ \ |_ _|"
echo "\___ \ | | / _ \ | |_) | | | "
echo " ___) | | | / ___ \ | _ < | | "
echo "|____/ |_| /_/ \_\ |_| \_\ |_| "
echo
echo "Upgrade your first network (BYFN) from v1.3.x to v1.4.x end-to-end test"
echo
CHANNEL_NAME="$1"
DELAY="$2"
LANGUAGE="$3"
TIMEOUT="$4"
VERBOSE="$5"
: ${CHANNEL_NAME:="mychannel"}
: ${DELAY:="5"}
: ${LANGUAGE:="golang"}
: ${TIMEOUT:="10"}
: ${VERBOSE:="false"}
LANGUAGE=$(echo "$LANGUAGE" | tr [:upper:] [:lower:])
COUNTER=1
MAX_RETRY=5

CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/"
if [ "$LANGUAGE" = "node" ]; then
CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/"
fi

echo "Channel name : "$CHANNEL_NAME

# import utils
. scripts/utils.sh

sleep $DELAY

#Query on chaincode on Peer0/Org1
echo "Querying chaincode on org1/peer0..."
chaincodeQuery 0 1 90

sleep $DELAY

#Invoke on chaincode on Peer0/Org1
echo "Sending invoke transaction on org1/peer0..."
chaincodeInvoke 0 1 0 2

sleep $DELAY

#Query on chaincode on Peer0/Org1
echo "Querying chaincode on org1/peer0..."
chaincodeQuery 0 1 80

echo
echo "===================== All GOOD, End-2-End UPGRADE Scenario execution completed ===================== "
echo

echo
echo " _____ _ _ ____ _____ ____ _____ "
echo "| ____| | \ | | | _ \ | ____| |___ \ | ____|"
echo "| _| | \| | | | | | _____ | _| __) | | _| "
echo "| |___ | |\ | | |_| | |_____| | |___ / __/ | |___ "
echo "|_____| |_| \_| |____/ |_____| |_____| |_____|"
echo

exit 0

0 comments on commit e1a39e6

Please sign in to comment.