/
start.sh
executable file
·59 lines (43 loc) · 1.15 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
#!/bin/bash
# check if mongo is installed
which mongo
if [ "$?" -ne 0 ]; then
echo 'You need to install Mongo DB for initializing the project'
exit 1
fi
which ipfs
if [ "$?" -ne 0 ]; then
echo 'You need to install IPFS DB for initializing the project'
exit 1
fi
which ganache-cli
if [ "$?" -ne 0 ]; then
echo "You need to install ganache-cli for initializing the project"
exit 1
fi
which node
if [ "$?" -ne 0 ]; then
echo "You need to install Node.js for initializing the project"
exit 1
fi
#kill all node previous instance
killall node
# install packages
npm install
# start IPFS
gnome-terminal -x sh -c "ipfs daemon"
# load ganache
gnome-terminal -x sh -c "ganache-cli"
# migrate smart contract to ganache
truffle migrate --network ganache
# start truffle console
gnome-terminal -x sh -c "truffle console --network ganache"
# drop db if exist
mongo consensys_app --eval "db.dropDatabase()"
# Start offchain server
#gnome-terminal -x sh -c "nodemon server.js --no-optional"
gnome-terminal -x sh -c "nodemon --inspect=0.0.0.0:9229 server.js"
# seed the blockchain with data
truffle exec seed.js --network ganache
# start the web server
npm run start