[FAB-8445] Adding IMAGE_TAG option to byfn

Adding IMAGE_TAG option to byfn script to launch specific version of
fabric network
Usage: ./byfn.sh -m up -i 1.0.6

Change-Id: Icaf9791705d50d7ccba380ac7a0867a9f9951be6
Signed-off-by: Surya <suryalnvs@gmail.com>
This commit is contained in:
Surya 2018-02-21 17:48:36 -05:00
parent f9794a7044
commit 84ff0e6680
5 changed files with 18 additions and 13 deletions

View file

@ -9,7 +9,7 @@ services:
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer
image: hyperledger/fabric-orderer:$IMAGE_TAG
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0

View file

@ -7,7 +7,7 @@ version: '2'
services:
peer-base:
image: hyperledger/fabric-peer
image: hyperledger/fabric-peer:$IMAGE_TAG
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# the following setting starts chaincode containers on the same

View file

@ -35,7 +35,7 @@ export FABRIC_CFG_PATH=${PWD}
# Print the usage message
function printHelp () {
echo "Usage: "
echo " byfn.sh -m up|down|restart|generate [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>]"
echo " byfn.sh -m up|down|restart|generate [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-i <imagetag>]"
echo " byfn.sh -h|--help (print this message)"
echo " -m <mode> - one of 'up', 'down', 'restart' or 'generate'"
echo " - 'up' - bring up the network with docker-compose up"
@ -47,12 +47,14 @@ function printHelp () {
echo " -d <delay> - delay duration in seconds (defaults to 3)"
echo " -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)"
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
echo " -i <imagetag> - pass the image tag to launch the network using the tag: 1.0.1, 1.0.2, 1.0.3, 1.0.4 (defaults to latest)"
echo
echo "Typically, one would first generate the required certificates and "
echo "genesis block, then bring up the network. e.g.:"
echo
echo " byfn.sh -m generate -c mychannel"
echo " byfn.sh -m up -c mychannel -s couchdb"
echo " byfn.sh -m up -c mychannel -s couchdb -i 1.0.6"
echo " byfn.sh -m down -c mychannel"
echo
echo "Taking all defaults:"
@ -111,9 +113,9 @@ function networkUp () {
generateChannelArtifacts
fi
if [ "${IF_COUCHDB}" == "couchdb" ]; then
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
IMAGE_TAG=$IMAGETAG CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
else
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
IMAGE_TAG=$IMAGETAG CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
fi
if [ $? -ne 0 ]; then
echo "ERROR !!!! Unable to start network"
@ -314,9 +316,10 @@ CHANNEL_NAME="mychannel"
COMPOSE_FILE=docker-compose-cli.yaml
#
COMPOSE_FILE_COUCH=docker-compose-couch.yaml
# default image tag
IMAGETAG="latest"
# Parse commandline args
while getopts "h?m:c:t:d:f:s:" opt; do
while getopts "h?m:c:t:d:f:s:i:" opt; do
case "$opt" in
h|\?)
printHelp
@ -334,6 +337,8 @@ while getopts "h?m:c:t:d:f:s:" opt; do
;;
s) IF_COUCHDB=$OPTARG
;;
i) IMAGETAG=`uname -m`"-"$OPTARG
;;
esac
done

View file

@ -11,7 +11,7 @@ networks:
services:
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
image: hyperledger/fabric-couchdb:$IMAGE_TAG
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
@ -38,7 +38,7 @@ services:
couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
image: hyperledger/fabric-couchdb:$IMAGE_TAG
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
@ -65,7 +65,7 @@ services:
couchdb2:
container_name: couchdb2
image: hyperledger/fabric-couchdb
image: hyperledger/fabric-couchdb:$IMAGE_TAG
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
@ -92,7 +92,7 @@ services:
couchdb3:
container_name: couchdb3
image: hyperledger/fabric-couchdb
image: hyperledger/fabric-couchdb:$IMAGE_TAG
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:

View file

@ -9,7 +9,7 @@ networks:
byfn:
services:
ca0:
image: hyperledger/fabric-ca
image: hyperledger/fabric-ca:$IMAGE_TAG
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
@ -26,7 +26,7 @@ services:
- byfn
ca1:
image: hyperledger/fabric-ca
image: hyperledger/fabric-ca:$IMAGE_TAG
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org2