mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-21 09:05:10 +00:00
[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 up -i 1.1.0-alpha Change-Id: I67a1d01257abd7021ea344c354c6e1c97eebf4f7 Signed-off-by: Surya <suryalnvs@gmail.com> Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
This commit is contained in:
parent
e4a0666893
commit
4f2cd8d4ac
8 changed files with 28 additions and 16 deletions
|
|
@ -1 +1,2 @@
|
||||||
COMPOSE_PROJECT_NAME=net
|
COMPOSE_PROJECT_NAME=net
|
||||||
|
IMAGE_TAG=latest
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ services:
|
||||||
|
|
||||||
orderer.example.com:
|
orderer.example.com:
|
||||||
container_name: orderer.example.com
|
container_name: orderer.example.com
|
||||||
image: hyperledger/fabric-orderer
|
image: hyperledger/fabric-orderer:$IMAGE_TAG
|
||||||
environment:
|
environment:
|
||||||
- ORDERER_GENERAL_LOGLEVEL=debug
|
- ORDERER_GENERAL_LOGLEVEL=debug
|
||||||
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
|
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ version: '2'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
peer-base:
|
peer-base:
|
||||||
image: hyperledger/fabric-peer
|
image: hyperledger/fabric-peer:$IMAGE_TAG
|
||||||
environment:
|
environment:
|
||||||
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
|
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
|
||||||
# the following setting starts chaincode containers on the same
|
# the following setting starts chaincode containers on the same
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export FABRIC_CFG_PATH=${PWD}
|
||||||
# Print the usage message
|
# Print the usage message
|
||||||
function printHelp () {
|
function printHelp () {
|
||||||
echo "Usage: "
|
echo "Usage: "
|
||||||
echo " byfn.sh up|down|restart|generate [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>]"
|
echo " byfn.sh 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 " byfn.sh -h|--help (print this message)"
|
||||||
echo " <mode> - one of 'up', 'down', 'restart' or 'generate'"
|
echo " <mode> - one of 'up', 'down', 'restart' or 'generate'"
|
||||||
echo " - 'up' - bring up the network with docker-compose up"
|
echo " - 'up' - bring up the network with docker-compose up"
|
||||||
|
|
@ -47,12 +47,14 @@ function printHelp () {
|
||||||
echo " -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)"
|
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 " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
||||||
echo " -l <language> - the chaincode language: golang (default) or node"
|
echo " -l <language> - the chaincode language: golang (default) or node"
|
||||||
|
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
||||||
echo
|
echo
|
||||||
echo "Typically, one would first generate the required certificates and "
|
echo "Typically, one would first generate the required certificates and "
|
||||||
echo "genesis block, then bring up the network. e.g.:"
|
echo "genesis block, then bring up the network. e.g.:"
|
||||||
echo
|
echo
|
||||||
echo " byfn.sh generate -c mychannel"
|
echo " byfn.sh generate -c mychannel"
|
||||||
echo " byfn.sh up -c mychannel -s couchdb"
|
echo " byfn.sh up -c mychannel -s couchdb"
|
||||||
|
echo " byfn.sh up -c mychannel -s couchdb -i 1.1.0-alpha"
|
||||||
echo " byfn.sh up -l node"
|
echo " byfn.sh up -l node"
|
||||||
echo " byfn.sh down -c mychannel"
|
echo " byfn.sh down -c mychannel"
|
||||||
echo
|
echo
|
||||||
|
|
@ -112,9 +114,9 @@ function networkUp () {
|
||||||
generateChannelArtifacts
|
generateChannelArtifacts
|
||||||
fi
|
fi
|
||||||
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
||||||
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
|
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
|
||||||
else
|
else
|
||||||
docker-compose -f $COMPOSE_FILE up -d 2>&1
|
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE up -d 2>&1
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "ERROR !!!! Unable to start network"
|
echo "ERROR !!!! Unable to start network"
|
||||||
|
|
@ -322,6 +324,8 @@ COMPOSE_FILE=docker-compose-cli.yaml
|
||||||
COMPOSE_FILE_COUCH=docker-compose-couch.yaml
|
COMPOSE_FILE_COUCH=docker-compose-couch.yaml
|
||||||
# use golang as the default language for chaincode
|
# use golang as the default language for chaincode
|
||||||
LANGUAGE=golang
|
LANGUAGE=golang
|
||||||
|
# default image tag
|
||||||
|
IMAGETAG="latest"
|
||||||
# Parse commandline args
|
# Parse commandline args
|
||||||
if [ "$1" = "-m" ];then # supports old usage, muscle memory is powerful!
|
if [ "$1" = "-m" ];then # supports old usage, muscle memory is powerful!
|
||||||
shift
|
shift
|
||||||
|
|
@ -341,7 +345,7 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts "h?c:t:d:f:s:l:" opt; do
|
while getopts "h?c:t:d:f:s:l:i:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
h|\?)
|
h|\?)
|
||||||
printHelp
|
printHelp
|
||||||
|
|
@ -359,6 +363,8 @@ while getopts "h?c:t:d:f:s:l:" opt; do
|
||||||
;;
|
;;
|
||||||
l) LANGUAGE=$OPTARG
|
l) LANGUAGE=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
i) IMAGETAG=`uname -m`"-"$OPTARG
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ services:
|
||||||
|
|
||||||
cli:
|
cli:
|
||||||
container_name: cli
|
container_name: cli
|
||||||
image: hyperledger/fabric-tools
|
image: hyperledger/fabric-tools:$IMAGE_TAG
|
||||||
tty: true
|
tty: true
|
||||||
environment:
|
environment:
|
||||||
- GOPATH=/opt/gopath
|
- GOPATH=/opt/gopath
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ networks:
|
||||||
services:
|
services:
|
||||||
couchdb0:
|
couchdb0:
|
||||||
container_name: 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
|
# 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.
|
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -38,7 +38,7 @@ services:
|
||||||
|
|
||||||
couchdb1:
|
couchdb1:
|
||||||
container_name: 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
|
# 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.
|
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -65,7 +65,7 @@ services:
|
||||||
|
|
||||||
couchdb2:
|
couchdb2:
|
||||||
container_name: 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
|
# 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.
|
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -92,7 +92,7 @@ services:
|
||||||
|
|
||||||
couchdb3:
|
couchdb3:
|
||||||
container_name: 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
|
# 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.
|
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
|
||||||
environment:
|
environment:
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ networks:
|
||||||
byfn:
|
byfn:
|
||||||
services:
|
services:
|
||||||
ca0:
|
ca0:
|
||||||
image: hyperledger/fabric-ca
|
image: hyperledger/fabric-ca:$IMAGE_TAG
|
||||||
environment:
|
environment:
|
||||||
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
|
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
|
||||||
- FABRIC_CA_SERVER_CA_NAME=ca-org1
|
- FABRIC_CA_SERVER_CA_NAME=ca-org1
|
||||||
|
|
@ -26,7 +26,7 @@ services:
|
||||||
- byfn
|
- byfn
|
||||||
|
|
||||||
ca1:
|
ca1:
|
||||||
image: hyperledger/fabric-ca
|
image: hyperledger/fabric-ca:$IMAGE_TAG
|
||||||
environment:
|
environment:
|
||||||
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
|
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
|
||||||
- FABRIC_CA_SERVER_CA_NAME=ca-org2
|
- FABRIC_CA_SERVER_CA_NAME=ca-org2
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ function printHelp () {
|
||||||
echo " -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)"
|
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 " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
||||||
echo " -l <language> - the chaincode language: golang (default) or node"
|
echo " -l <language> - the chaincode language: golang (default) or node"
|
||||||
|
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
||||||
echo
|
echo
|
||||||
echo "Typically, one would first generate the required certificates and "
|
echo "Typically, one would first generate the required certificates and "
|
||||||
echo "genesis block, then bring up the network. e.g.:"
|
echo "genesis block, then bring up the network. e.g.:"
|
||||||
|
|
@ -97,9 +98,9 @@ function networkUp () {
|
||||||
fi
|
fi
|
||||||
# start org3 peers
|
# start org3 peers
|
||||||
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
||||||
docker-compose -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH_ORG3 up -d 2>&1
|
IMAGE_TAG=${IMAGETAG} docker-compose -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH_ORG3 up -d 2>&1
|
||||||
else
|
else
|
||||||
docker-compose -f $COMPOSE_FILE_ORG3 up -d 2>&1
|
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE_ORG3 up -d 2>&1
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "ERROR !!!! Unable to start Org3 network"
|
echo "ERROR !!!! Unable to start Org3 network"
|
||||||
|
|
@ -241,6 +242,8 @@ COMPOSE_FILE_ORG3=docker-compose-org3.yaml
|
||||||
COMPOSE_FILE_COUCH_ORG3=docker-compose-couch-org3.yaml
|
COMPOSE_FILE_COUCH_ORG3=docker-compose-couch-org3.yaml
|
||||||
# use golang as the default language for chaincode
|
# use golang as the default language for chaincode
|
||||||
LANGUAGE=golang
|
LANGUAGE=golang
|
||||||
|
# default image tag
|
||||||
|
IMAGETAG="latest"
|
||||||
|
|
||||||
# Parse commandline args
|
# Parse commandline args
|
||||||
if [ "$1" = "-m" ];then # supports old usage, muscle memory is powerful!
|
if [ "$1" = "-m" ];then # supports old usage, muscle memory is powerful!
|
||||||
|
|
@ -260,7 +263,7 @@ else
|
||||||
printHelp
|
printHelp
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
while getopts "h?c:t:d:f:s:l:" opt; do
|
while getopts "h?c:t:d:f:s:l:i:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
h|\?)
|
h|\?)
|
||||||
printHelp
|
printHelp
|
||||||
|
|
@ -278,6 +281,8 @@ while getopts "h?c:t:d:f:s:l:" opt; do
|
||||||
;;
|
;;
|
||||||
l) LANGUAGE=$OPTARG
|
l) LANGUAGE=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
i) IMAGETAG=$OPTARG
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue