-
Notifications
You must be signed in to change notification settings - Fork 3
/
start.sh
executable file
·61 lines (53 loc) · 1.53 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
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
#Hovig Ohannessian
set -e
# Cleanup any existing local docker images, volumes & containers
echo "Removing existing containers"
docker stop $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images -q) -f
# export path to go folder
export GOPATH=$HOME/go
GOROOT=$GOPATH/src/github.com/hyperledger
DIR_FABRIC="fabric-samples"
DIR_APP="web3-voting-dapp"
DIR_CHAINCODE_EVM="fabric-chaincode-evm"
if [ -d $GOROOT ]; then
echo "$GOROOT directory exists"
else
#create new folder
sudo mkdir -p $GOROOT
chmod +x $GOROOT
fi
cd $GOROOT
echo "$GOROOT"
if [ ! -d "$DIR_FABRIC" ]; then
# clone fabric samples version 1.3
git clone https://github.com/hyperledger/fabric-samples.git
fi
echo "fabric-samples exists"
if [ ! -d "$DIR_APP" ]; then
# clone the voting repo
git clone https://github.com/hovig/web3-fabric-voting-dapp.git
fi
echo "web3-fabric-voting-dapp exists"
chmod 777 fabric-samples
cd fabric-samples
git checkout release-1.3
# install/run the latest docker images for Hyperledger Fabric
./scripts/bootstrap.sh
cd $GOROOT
if [ ! -d "$DIR_CHAINCODE_EVM" ]; then
# clone fabric chaincode evm
git clone https://github.com/hyperledger/fabric-chaincode-evm.git
fi
chmod 777 fabric-chaincode-evm
echo "fabric-chaincode-evm exists"
cd $GOROOT/fabric-samples/first-network
rm -rf docker-compose-cli.yaml
# copy this modified yaml file that includes chaincode evm volume
cp $GOROOT/web3-fabric-voting-dapp/scripts/docker-compose-cli.yaml .
# fabric network execution
./byfn.sh -m down
./byfn.sh -m up
docker exec -it cli bash