-
Notifications
You must be signed in to change notification settings - Fork 42
/
startFabric-Peer2.sh
executable file
·36 lines (26 loc) · 1.22 KB
/
startFabric-Peer2.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
#!/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-peer2.yml down
ARCH=$ARCH docker-compose -f "${DIR}"/composer/docker-compose-peer2.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}
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer2.org1.example.com peer channel fetch config -o orderer.example.com:7050 -c composerchannel
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer2.org1.example.com peer channel join -b composerchannel_config.block