-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunchDevEnv.sh
97 lines (76 loc) · 1.52 KB
/
launchDevEnv.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
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
#!/bin/bash
if ! hash docker 2>/dev/null; then
echo "Docker Missing - Please install docker to run the development environment"
exit
fi
if ! pgrep docker 2>/dev/null; then
echo "Please start Docker before running this script. Docker Process Not Found"
exit
fi
help(){
echo "Script to launch docker for local geth blockchain and indexer infrastructure components "
echo "Usage: launchDevEnv.sh [-a] [-i] [-b]"
echo " -a - launch both local blockchain and indexer infrastructure in docker"
echo " -b - only launch local blockchain in docker"
echo " -i - only launch local indexer infrastructure in docker"
echo " -h - show this help"
}
BLOCKCHAIN=0
INFRA=0
HELP=0
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-a)
BLOCKCHAIN=1
INFRA=1
shift
;;
-b)
BLOCKCHAIN=1
shift
;;
-i)
INFRA=1
shift
;;
-h)
HELP=1
shift
;;
*)
POSITIONAL+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL[@]}"
if [ $BLOCKCHAIN -eq 0 ]; then
if [ $INFRA -eq 0 ]; then
help
exit
fi
fi
if [[ HELP -ne 0 ]]; then
help
exit
fi
cd ./docker || exit
if [ $BLOCKCHAIN -ne 0 ]; then
cd ./blockchain || exit
sudo rm -rf ./consensus/beacondata
sudo rm -rf ./consensus/validatordata
sudo rm -rf ./consensus/genesis.ssz
sudo rm -rf ./execution/geth
docker compose down
docker compose up -d
cd .. || exit
fi
if [[ $INFRA -ne 0 ]]; then
cd ./infrastructure || exit
docker compose down
docker compose up -d
cd .. || exit
fi