-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·49 lines (39 loc) · 1.24 KB
/
start.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
#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# This script does everything required to run the fabric CA sample.
#
set -e
SDIR=$(dirname "$0")
source ${SDIR}/scripts/env.sh
cd ${SDIR}
# Delete docker containers
dockerContainers=$(docker ps -a | awk '$2~/hyperledger/ {print $1}')
if [ "$dockerContainers" != "" ]; then
log "Deleting existing docker containers ..."
docker rm -f $dockerContainers > /dev/null
fi
# Remove chaincode docker images
chaincodeImages=`docker images | grep "^dev-peer" | awk '{print $3}'`
if [ "$chaincodeImages" != "" ]; then
log "Removing chaincode docker images ..."
docker rmi -f $chaincodeImages > /dev/null
fi
# Start with a clean data directory
DDIR=${SDIR}/${DATA}
if [ -d ${DDIR} ]; then
log "Cleaning up the data directory from previous run at $DDIR"
# rm -rf ${SDIR}/data
fi
mkdir -p ${DDIR}/logs
# Create the docker-compose file
#${SDIR}/makeDocker.sh
# Create the docker containers
log "Creating docker containers ..."
docker-compose up -d
# Wait for the setup container to complete
dowait "the 'setup' container to finish registering identities, creating the genesis block and other artifacts" 90 $SDIR/$SETUP_LOGFILE $SDIR/$SETUP_SUCCESS_FILE