@@ -35,7 +35,7 @@ export VERBOSE=false
35
35
# Print the usage message
36
36
function printHelp() {
37
37
echo " Usage: "
38
- echo " byfn.sh <mode> [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-l <language>] [-o <consensus-type>] [-i <imagetag>] [-v]"
38
+ echo " byfn.sh <mode> [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-l <language>] [-o <consensus-type>] [-i <imagetag>] [-a] [- v]"
39
39
echo " <mode> - one of 'up', 'down', 'restart', 'generate' or 'upgrade'"
40
40
echo " - 'up' - bring up the network with docker-compose up"
41
41
echo " - 'down' - clear the network with docker-compose down"
@@ -50,6 +50,7 @@ function printHelp() {
50
50
echo " -l <language> - the chaincode language: golang (default) or node"
51
51
echo " -o <consensus-type> - the consensus-type of the ordering service: solo (default), kafka, or etcdraft"
52
52
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \" latest\" )"
53
+ echo " -a - launch certificate authorities (no certificate authorities are launched by default)"
53
54
echo " -v - verbose mode"
54
55
echo " byfn.sh -h (print this message)"
55
56
echo
@@ -156,29 +157,22 @@ function networkUp() {
156
157
replacePrivateKey
157
158
generateChannelArtifacts
158
159
fi
160
+ COMPOSE_FILES=" -f ${COMPOSE_FILE} "
161
+ if [ " ${CERTIFICATE_AUTHORITIES} " == " true" ]; then
162
+ COMPOSE_FILES=" ${COMPOSE_FILES} -f ${COMPOSE_FILE_CA} "
163
+ export BYFN_CA1_PRIVATE_KEY=$( cd crypto-config/peerOrganizations/org1.example.com/ca && ls * _sk)
164
+ export BYFN_CA2_PRIVATE_KEY=$( cd crypto-config/peerOrganizations/org2.example.com/ca && ls * _sk)
165
+ fi
166
+ if [ " ${CONSENSUS_TYPE} " == " kafka" ]; then
167
+ COMPOSE_FILES=" ${COMPOSE_FILES} -f ${COMPOSE_FILE_KAFKA} "
168
+ elif [ " ${CONSENSUS_TYPE} " == " etcdraft" ]; then
169
+ COMPOSE_FILES=" ${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2} "
170
+ fi
159
171
if [ " ${IF_COUCHDB} " == " couchdb" ]; then
160
- if [ " $CONSENSUS_TYPE " == " kafka" ]; then
161
- IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_COUCH up -d 2>&1
162
- docker ps -a
163
- elif [ " $CONSENSUS_TYPE " == " etcdraft" ]; then
164
- IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_COUCH up -d 2>&1
165
- docker ps -a
166
- else
167
- IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
168
- docker ps -a
169
- fi
170
- else
171
- if [ " $CONSENSUS_TYPE " == " kafka" ]; then
172
- IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA up -d 2>&1
173
- docker ps -a
174
- elif [ " $CONSENSUS_TYPE " == " etcdraft" ]; then
175
- IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 up -d 2>&1
176
- docker ps -a
177
- else
178
- IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE up -d 2>&1
179
- docker ps -a
180
- fi
172
+ COMPOSE_FILES=" ${COMPOSE_FILES} -f ${COMPOSE_FILE_COUCH} "
181
173
fi
174
+ IMAGE_TAG=$IMAGETAG docker-compose ${COMPOSE_FILES} up -d 2>&1
175
+ docker ps -a
182
176
if [ $? -ne 0 ]; then
183
177
echo " ERROR !!!! Unable to start network"
184
178
exit 1
@@ -197,7 +191,7 @@ function networkUp() {
197
191
fi
198
192
199
193
# now run the end to end script
200
- docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE
194
+ docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE $NO_CHAINCODE
201
195
if [ $? -ne 0 ]; then
202
196
echo " ERROR !!!! Test failed"
203
197
exit 1
@@ -221,22 +215,19 @@ function upgradeNetwork() {
221
215
mkdir -p $LEDGERS_BACKUP
222
216
223
217
export IMAGE_TAG=$IMAGETAG
218
+ COMPOSE_FILES=" -f ${COMPOSE_FILE} "
219
+ if [ " ${CERTIFICATE_AUTHORITIES} " == " true" ]; then
220
+ COMPOSE_FILES=" ${COMPOSE_FILES} -f ${COMPOSE_FILE_CA} "
221
+ export BYFN_CA1_PRIVATE_KEY=$( cd crypto-config/peerOrganizations/org1.example.com/ca && ls * _sk)
222
+ export BYFN_CA2_PRIVATE_KEY=$( cd crypto-config/peerOrganizations/org2.example.com/ca && ls * _sk)
223
+ fi
224
+ if [ " ${CONSENSUS_TYPE} " == " kafka" ]; then
225
+ COMPOSE_FILES=" ${COMPOSE_FILES} -f ${COMPOSE_FILE_KAFKA} "
226
+ elif [ " ${CONSENSUS_TYPE} " == " etcdraft" ]; then
227
+ COMPOSE_FILES=" ${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2} "
228
+ fi
224
229
if [ " ${IF_COUCHDB} " == " couchdb" ]; then
225
- if [ " $CONSENSUS_TYPE " == " kafka" ]; then
226
- COMPOSE_FILES=" -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_COUCH "
227
- elif [ " $CONSENSUS_TYPE " == " etcdraft" ]; then
228
- COMPOSE_FILES=" -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_COUCH "
229
- else
230
- COMPOSE_FILES=" -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH "
231
- fi
232
- else
233
- if [ " $CONSENSUS_TYPE " == " kafka" ]; then
234
- COMPOSE_FILES=" -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA "
235
- elif [ " $CONSENSUS_TYPE " == " etcdraft" ]; then
236
- COMPOSE_FILES=" -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 "
237
- else
238
- COMPOSE_FILES=" -f $COMPOSE_FILE "
239
- fi
230
+ COMPOSE_FILES=" ${COMPOSE_FILES} -f ${COMPOSE_FILE_COUCH} "
240
231
fi
241
232
242
233
# removing the cli container
@@ -283,7 +274,7 @@ function upgradeNetwork() {
283
274
function networkDown() {
284
275
# stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3
285
276
# stop kafka and zookeeper containers in case we're running with kafka consensus-type
286
- docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans
277
+ docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_CA -f $ COMPOSE_FILE_ORG3 down --volumes --remove-orphans
287
278
288
279
# Don't remove the generated artifacts -- note, the ledgers are always removed
289
280
if [ " $MODE " != " restart" ]; then
@@ -508,6 +499,8 @@ COMPOSE_FILE_ORG3=docker-compose-org3.yaml
508
499
COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml
509
500
# two additional etcd/raft orderers
510
501
COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml
502
+ # certificate authorities compose file
503
+ COMPOSE_FILE_CA=docker-compose-ca.yaml
511
504
#
512
505
# use golang as the default language for chaincode
513
506
LANGUAGE=golang
537
530
exit 1
538
531
fi
539
532
540
- while getopts " h?c:t:d:f:s:l:i:o:v " opt; do
533
+ while getopts " h?c:t:d:f:s:l:i:o:av " opt; do
541
534
case " $opt " in
542
535
h | \? )
543
536
printHelp
@@ -567,6 +560,9 @@ while getopts "h?c:t:d:f:s:l:i:o:v" opt; do
567
560
o)
568
561
CONSENSUS_TYPE=$OPTARG
569
562
;;
563
+ a)
564
+ CERTIFICATE_AUTHORITIES=true
565
+ ;;
570
566
v)
571
567
VERBOSE=true
572
568
;;
0 commit comments