forked from EYBlockchain/nightfall_3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-nightfall
executable file
·107 lines (91 loc) · 3.1 KB
/
start-nightfall
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#! /bin/bash
VOLUME_LIST=$(docker volume ls -q)
FILE=
STUBS=
usage()
{
echo "Usage:"
echo " -g or --ganache; for a ganache simulator"
echo " -l or --localhost; to connect to an already running blockchain on ws://localhost:8546"
echo " -s or --stubs; runs with circuits stubbed out (faster but no checking of ZKP code) - use with either -g or -l"
echo " -h or --help; to print this message"
}
# select a Geth or Ganache client
if [ -z "$1" ]; then
usage
exit 1
fi
while [ -n "$1" ]; do
case $1 in
-g | --ganache ) FILE="-f docker-compose.yml -f docker-compose.ganache.yml"
;;
-l | --localhost ) FILE="-f docker-compose.yml -f docker-compose.host.docker.internal.yml"
;;
-h | --help ) usage
;;
-s | --stubs ) STUBS="-f docker-compose.stubs.yml"
;;
* ) usage
exit 1
esac
shift
done
# FILE should always be set. Asking for -s on its own makes no sense
if [ -z "$FILE" ]; then
usage
exit 1
fi
# shut down cleanly in the event of a cntl-c etc. We don't want to leave containers running
trap "docker-compose $FILE $STUBS down --remove-orphans -t 1; exit 1" SIGHUP SIGINT SIGTERM
docker-compose -f docker-compose.yml $FILE $STUBS down --remove-orphans
# if-else block checks - volume exist and then removes it.
if [[ $(echo $VOLUME_LIST | grep nightfall_3_timber-database-volume1) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_timber-database-volume1
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_timber-database-volume2) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_timber-database-volume2
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_mongodb1) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_mongodb1
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_mongodb2) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_mongodb2
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_build) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_build
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_geth1-chain) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_geth1-chain
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_geth2-chain) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_geth2-chain
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_geth-miner-chain1) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_geth-miner-chain1
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_dag1) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_dag1
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_geth-miner-chain2) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_geth-miner-chain2
fi
if [[ $(echo $VOLUME_LIST | grep nightfall_3_dag2) ]]; then
echo -n 'Removing '
docker volume rm nightfall_3_dag2
fi
DIR=./common-files/node_modules
if [[ -d "$DIR" ]]; then
rm -dr common-files/node_modules
fi
#docker-compose -f docker-compose.yml $FILE up -d deployer
docker-compose $FILE $STUBS up