mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-21 00:55:10 +00:00
[FAB-15803] Upgrade to v1.4.2
Upgrading to v1.4.2 from v1.4.1 and enabling v1_4_2 capabilities on orderer system channel and applicaiton channel for channel and orderer groups Signed-off-by: Surya Lanka <suryalnvs@gmail.com> Change-Id: I41e575ba8b56122a55fe148b65972884aaf49627
This commit is contained in:
parent
36ef140439
commit
d50fbc4f69
6 changed files with 130 additions and 14 deletions
|
|
@ -1,2 +1,3 @@
|
||||||
COMPOSE_PROJECT_NAME=net
|
COMPOSE_PROJECT_NAME=net
|
||||||
IMAGE_TAG=latest
|
IMAGE_TAG=latest
|
||||||
|
SYS_CHANNEL=byfn-sys-channel
|
||||||
|
|
|
||||||
|
|
@ -422,11 +422,11 @@ function generateChannelArtifacts() {
|
||||||
echo "CONSENSUS_TYPE="$CONSENSUS_TYPE
|
echo "CONSENSUS_TYPE="$CONSENSUS_TYPE
|
||||||
set -x
|
set -x
|
||||||
if [ "$CONSENSUS_TYPE" == "solo" ]; then
|
if [ "$CONSENSUS_TYPE" == "solo" ]; then
|
||||||
configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
configtxgen -profile TwoOrgsOrdererGenesis -channelID $SYS_CHANNEL -outputBlock ./channel-artifacts/genesis.block
|
||||||
elif [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
elif [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
||||||
configtxgen -profile SampleDevModeKafka -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
configtxgen -profile SampleDevModeKafka -channelID $SYS_CHANNEL -outputBlock ./channel-artifacts/genesis.block
|
||||||
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||||
configtxgen -profile SampleMultiNodeEtcdRaft -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
configtxgen -profile SampleMultiNodeEtcdRaft -channelID $SYS_CHANNEL -outputBlock ./channel-artifacts/genesis.block
|
||||||
else
|
else
|
||||||
set +x
|
set +x
|
||||||
echo "unrecognized CONSESUS_TYPE='$CONSENSUS_TYPE'. exiting"
|
echo "unrecognized CONSESUS_TYPE='$CONSENSUS_TYPE'. exiting"
|
||||||
|
|
@ -488,6 +488,8 @@ OS_ARCH=$(echo "$(uname -s | tr '[:upper:]' '[:lower:]' | sed 's/mingw64_nt.*/wi
|
||||||
CLI_TIMEOUT=10
|
CLI_TIMEOUT=10
|
||||||
# default for delay between commands
|
# default for delay between commands
|
||||||
CLI_DELAY=3
|
CLI_DELAY=3
|
||||||
|
# system channel name defaults to "byfn-sys-channel"
|
||||||
|
SYS_CHANNEL="byfn-sys-channel"
|
||||||
# channel name defaults to "mychannel"
|
# channel name defaults to "mychannel"
|
||||||
CHANNEL_NAME="mychannel"
|
CHANNEL_NAME="mychannel"
|
||||||
# use this as the default docker-compose yaml definition
|
# use this as the default docker-compose yaml definition
|
||||||
|
|
|
||||||
|
|
@ -128,32 +128,35 @@ Capabilities:
|
||||||
# supported by both.
|
# supported by both.
|
||||||
# Set the value of the capability to true to require it.
|
# Set the value of the capability to true to require it.
|
||||||
Channel: &ChannelCapabilities
|
Channel: &ChannelCapabilities
|
||||||
# V1.3 for Channel is a catchall flag for behavior which has been
|
# V1.4.2 for Channel is a catchall flag for behavior which has been
|
||||||
# determined to be desired for all orderers and peers running at the v1.3.x
|
# determined to be desired for all orderers and peers running at the v1.4.2
|
||||||
# level, but which would be incompatible with orderers and peers from
|
# level, but which would be incompatible with orderers and peers from
|
||||||
# prior releases.
|
# prior releases.
|
||||||
# Prior to enabling V1.3 channel capabilities, ensure that all
|
# Prior to enabling V1.4.2 channel capabilities, ensure that all
|
||||||
# orderers and peers on a channel are at v1.3.0 or later.
|
# orderers and peers on a channel are at v1.4.2 or later.
|
||||||
V1_3: true
|
V1_4_2: true
|
||||||
|
|
||||||
# Orderer capabilities apply only to the orderers, and may be safely
|
# Orderer capabilities apply only to the orderers, and may be safely
|
||||||
# used with prior release peers.
|
# used with prior release peers.
|
||||||
# Set the value of the capability to true to require it.
|
# Set the value of the capability to true to require it.
|
||||||
Orderer: &OrdererCapabilities
|
Orderer: &OrdererCapabilities
|
||||||
# V1.1 for Orderer is a catchall flag for behavior which has been
|
# V1.4.2 for Orderer is a catchall flag for behavior which has been
|
||||||
# determined to be desired for all orderers running at the v1.1.x
|
# determined to be desired for all orderers running at the v1.4.2
|
||||||
# level, but which would be incompatible with orderers from prior releases.
|
# level, but which would be incompatible with orderers from prior releases.
|
||||||
# Prior to enabling V1.1 orderer capabilities, ensure that all
|
# Prior to enabling V1.4.2 orderer capabilities, ensure that all
|
||||||
# orderers on a channel are at v1.1.0 or later.
|
# orderers on a channel are at v1.4.2 or later.
|
||||||
V1_1: true
|
V1_4_2: true
|
||||||
|
|
||||||
# Application capabilities apply only to the peer network, and may be safely
|
# Application capabilities apply only to the peer network, and may be safely
|
||||||
# used with prior release orderers.
|
# used with prior release orderers.
|
||||||
# Set the value of the capability to true to require it.
|
# Set the value of the capability to true to require it.
|
||||||
Application: &ApplicationCapabilities
|
Application: &ApplicationCapabilities
|
||||||
|
# V1.4.2 for Application enables the new non-backwards compatible
|
||||||
|
# features and fixes of fabric v1.4.2.
|
||||||
|
V1_4_2: true
|
||||||
# V1.3 for Application enables the new non-backwards compatible
|
# V1.3 for Application enables the new non-backwards compatible
|
||||||
# features and fixes of fabric v1.3.
|
# features and fixes of fabric v1.3.
|
||||||
V1_3: true
|
V1_3: false
|
||||||
# V1.2 for Application enables the new non-backwards compatible
|
# V1.2 for Application enables the new non-backwards compatible
|
||||||
# features and fixes of fabric v1.2 (note, this need not be set if
|
# features and fixes of fabric v1.2 (note, this need not be set if
|
||||||
# later version capabilities are set)
|
# later version capabilities are set)
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ services:
|
||||||
tty: true
|
tty: true
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
environment:
|
environment:
|
||||||
|
- SYS_CHANNEL=$SYS_CHANNEL
|
||||||
- GOPATH=/opt/gopath
|
- GOPATH=/opt/gopath
|
||||||
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
|
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
|
||||||
#- FABRIC_LOGGING_SPEC=DEBUG
|
#- FABRIC_LOGGING_SPEC=DEBUG
|
||||||
|
|
|
||||||
9
first-network/scripts/capabilities.json
Normal file
9
first-network/scripts/capabilities.json
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"mod_policy": "Admins",
|
||||||
|
"value": {
|
||||||
|
"capabilities": {
|
||||||
|
"V1_4_2": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": "0"
|
||||||
|
}
|
||||||
|
|
@ -22,17 +22,117 @@ VERBOSE="$5"
|
||||||
LANGUAGE=$(echo "$LANGUAGE" | tr [:upper:] [:lower:])
|
LANGUAGE=$(echo "$LANGUAGE" | tr [:upper:] [:lower:])
|
||||||
COUNTER=1
|
COUNTER=1
|
||||||
MAX_RETRY=5
|
MAX_RETRY=5
|
||||||
|
SYS_CHANNEL=$SYS_CHANNEL
|
||||||
|
|
||||||
CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/"
|
CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/"
|
||||||
if [ "$LANGUAGE" = "node" ]; then
|
if [ "$LANGUAGE" = "node" ]; then
|
||||||
CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/"
|
CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "System channel name : "$SYS_CHANNEL
|
||||||
echo "Channel name : "$CHANNEL_NAME
|
echo "Channel name : "$CHANNEL_NAME
|
||||||
|
|
||||||
# import utils
|
# import utils
|
||||||
. scripts/utils.sh
|
. scripts/utils.sh
|
||||||
|
|
||||||
|
# addCapabilityToChannel <channel_id> <capabilities_group>
|
||||||
|
# This function pulls the current channel config, modifies it with capabilities
|
||||||
|
# for the specified group, computes the config update, signs, and submits it.
|
||||||
|
addCapabilityToChannel() {
|
||||||
|
CH_NAME=$1
|
||||||
|
GROUP=$2
|
||||||
|
|
||||||
|
setOrdererGlobals
|
||||||
|
|
||||||
|
# Get the current channel config, decode and write it to config.json
|
||||||
|
fetchChannelConfig $CH_NAME config.json
|
||||||
|
|
||||||
|
# Modify the correct section of the config based on capabilities group
|
||||||
|
if [ $GROUP == "orderer" ]; then
|
||||||
|
jq -s '.[0] * {"channel_group":{"groups":{"Orderer": {"values": {"Capabilities": .[1]}}}}}' config.json ./scripts/capabilities.json > modified_config.json
|
||||||
|
elif [ $GROUP == "channel" ]; then
|
||||||
|
jq -s '.[0] * {"channel_group":{"values": {"Capabilities": .[1]}}}' config.json ./scripts/capabilities.json > modified_config.json
|
||||||
|
elif [ $GROUP == "application" ]; then
|
||||||
|
jq -s '.[0] * {"channel_group":{"groups":{"Application": {"values": {"Capabilities": .[1]}}}}}' config.json ./scripts/capabilities.json > modified_config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a config updated for this channel based on the differences between config.json and modified_config.json
|
||||||
|
# write the output to config_update_in_envelope.pb
|
||||||
|
createConfigUpdate "$CH_NAME" config.json modified_config.json config_update_in_envelope.pb
|
||||||
|
|
||||||
|
# Sign, and set the correct identity for submission.
|
||||||
|
if [ $CH_NAME != $SYS_CHANNEL ] ; then
|
||||||
|
if [ $GROUP == "orderer" ]; then
|
||||||
|
# Modifying the orderer group requires only the Orderer admin to sign.
|
||||||
|
# Prepare to sign the update as the OrdererOrg.Admin
|
||||||
|
setOrdererGlobals
|
||||||
|
elif [ $GROUP == "channel" ]; then
|
||||||
|
# Modifying the channel group requires a majority of application admins and the orderer admin to sign.
|
||||||
|
# Sign with PeerOrg1.Admin
|
||||||
|
signConfigtxAsPeerOrg 1 config_update_in_envelope.pb
|
||||||
|
# Sign with PeerOrg2.Admin
|
||||||
|
signConfigtxAsPeerOrg 2 config_update_in_envelope.pb
|
||||||
|
# Prepare to sign the update as the OrdererOrg.Admin
|
||||||
|
setOrdererGlobals
|
||||||
|
elif [ $GROUP == "application" ]; then
|
||||||
|
# Modifying the application group requires a majority of application admins to sign.
|
||||||
|
# Sign with PeerOrg1.Admin
|
||||||
|
signConfigtxAsPeerOrg 1 config_update_in_envelope.pb
|
||||||
|
# Prepare to sign the update as the PeerOrg2.Admin
|
||||||
|
setGlobals 0 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# For the orderer system channel, only the orderer admin needs sign
|
||||||
|
# which will be attached during the update
|
||||||
|
setOrdererGlobals
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
||||||
|
set -x
|
||||||
|
peer channel update -f config_update_in_envelope.pb -c $CH_NAME -o orderer.example.com:7050 --cafile $ORDERER_CA
|
||||||
|
res=$?
|
||||||
|
set +x
|
||||||
|
else
|
||||||
|
set -x
|
||||||
|
peer channel update -f config_update_in_envelope.pb -c $CH_NAME -o orderer.example.com:7050 --tls true --cafile $ORDERER_CA
|
||||||
|
res=$?
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
|
verifyResult $res "Config update for \"$GROUP\" on \"$CH_NAME\" failed"
|
||||||
|
echo "===================== Config update for \"$GROUP\" on \"$CH_NAME\" is completed ===================== "
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep $DELAY
|
||||||
|
|
||||||
|
#Config update for /Channel on $SYS_CHANNEL
|
||||||
|
echo "Config update for /Channel on \"$SYS_CHANNEL\""
|
||||||
|
addCapabilityToChannel $SYS_CHANNEL channel
|
||||||
|
|
||||||
|
sleep $DELAY
|
||||||
|
|
||||||
|
#Config update for /Channel/Orderer on $SYS_CHANNEL
|
||||||
|
echo "Config update for /Channel/Orderer on \"$SYS_CHANNEL\""
|
||||||
|
addCapabilityToChannel $SYS_CHANNEL orderer
|
||||||
|
|
||||||
|
sleep $DELAY
|
||||||
|
|
||||||
|
#Config update for /Channel on $CHANNEL_NAME
|
||||||
|
echo "Config update for /Channel on \"$CHANNEL_NAME\""
|
||||||
|
addCapabilityToChannel $CHANNEL_NAME channel
|
||||||
|
|
||||||
|
sleep $DELAY
|
||||||
|
|
||||||
|
#Config update for /Channel/Orderer
|
||||||
|
echo "Config update for /Channel/Orderer on \"$CHANNEL_NAME\""
|
||||||
|
addCapabilityToChannel $CHANNEL_NAME orderer
|
||||||
|
|
||||||
|
sleep $DELAY
|
||||||
|
|
||||||
|
#Config update for /Channel/Application
|
||||||
|
echo "Config update for /Channel/Application on \"$CHANNEL_NAME\""
|
||||||
|
addCapabilityToChannel $CHANNEL_NAME application
|
||||||
|
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
|
|
||||||
#Query on chaincode on Peer0/Org1
|
#Query on chaincode on Peer0/Org1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue