forked from InflatibleYoshi/fabric-1.1-kafka-multi-orderer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
startFabric.sh
executable file
·50 lines (36 loc) · 2.22 KB
/
startFabric.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
if [ -z ${FABRIC_START_TIMEOUT+x} ]; then
echo "FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)"
export FABRIC_START_TIMEOUT=15
else
re='^[0-9]+$'
if ! [[ $FABRIC_START_TIMEOUT =~ $re ]] ; then
echo "FABRIC_START_TIMEOUT: Not a number" >&2; exit 1
fi
echo "FABRIC_START_TIMEOUT is set to '$FABRIC_START_TIMEOUT'"
fi
# Exit on first error, print all commands.
set -ev
#Detect architecture
ARCH=`uname -m`
# Grab the current directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#
ARCH=$ARCH docker-compose -f "${DIR}"/composer/docker-compose.yml down
ARCH=$ARCH docker-compose -f "${DIR}"/composer/docker-compose.yml up -d
# wait for Hyperledger Fabric to start
# incase of errors when running later commands, issue export FABRIC_START_TIMEOUT=<larger number>
echo ${FABRIC_START_TIMEOUT}
sleep ${FABRIC_START_TIMEOUT}
# Create the channel
docker exec peer0.org1.example.com peer channel create -o orderer0.example.com:7050 -c composerchannel -f /etc/hyperledger/configtx/composer-channel.tx --tls --cafile /etc/hyperledger/msp/orderer/msp/tlscacerts/tlsca.example.com-cert.pem
echo ${FABRIC_START_TIMEOUT}
sleep ${FABRIC_START_TIMEOUT}
sleep ${FABRIC_START_TIMEOUT}
# Join peer0.org1.example.com to the channel.
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/[email protected]/msp" peer0.org1.example.com peer channel join -b composerchannel.block --tls --cafile /etc/hyperledger/msp/orderer/msp/tlscacerts/tlsca.example.com-cert.pem
# # Create the channel
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/[email protected]/msp" peer1.org1.example.com peer channel fetch config -o orderer0.example.com:7050 -c composerchannel --tls --cafile /etc/hyperledger/msp/orderer/msp/tlscacerts/tlsca.example.com-cert.pem
# docker exec peer1.org1.example.com peer channel create -o orderer.example.com:7050 -c composerchannel -f /etc/hyperledger/configtx/composer-channel.tx
# # Join peer1.org1.example.com to the channel.
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/[email protected]/msp" peer1.org1.example.com peer channel join -b composerchannel_config.block --tls --cafile /etc/hyperledger/msp/orderer/msp/tlscacerts/tlsca.example.com-cert.pem