forked from virtualeconomy/v-systems
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_nodes.sh
executable file
·51 lines (42 loc) · 1.6 KB
/
start_nodes.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
#!/bin/bash
echo "[-----INFO-----] Wallet data file: $1/wallet.dat"
sbt clean
echo "[-----INFO-----] Old target cleaned!"
sbt -Dnetwork=testnet packageAll
echo "[-----INFO-----] Project compiled!"
sbt it:test
echo "[-----INFO-----] Docker file completed!"
echo "[-----INFO-----] Stopping old containers..."
docker stop peer_container
docker stop minter_container
docker rm peer_container
docker rm minter_container
docker rmi peer_node_img
docker build -t peer_node_img target/docker
echo "[-----INFO-----] Image for peer node built!"
if [ -x minter_target ]; then
rm -rf minter_target
fi
mkdir minter_target
mkdir minter_target/docker
cp -a target/docker/. minter_target/docker
if [[ -n $2 && $2 != "" ]]; then
IP_PORT=$2:19923
else
IP_PORT=172.17.0.2:9923
fi
echo $IP_PORT
ORIGIN_PEER="known-peers = \[\]"
NEW_PEER="known-peers = [\"$IP_PORT\"]"
sed -i "" "s|$ORIGIN_PEER|$NEW_PEER|" minter_target/docker/1/template.conf
cp $1/wallet.dat minter_target/docker/1
gsed -i "s|RUN|ADD 1/wallet.dat /tmp/vsys/wallet/\n&|" minter_target/docker/Dockerfile
docker rmi minter_node_img
docker build -t minter_node_img minter_target/docker
echo "[-----INFO-----] Image for minter node built!"
echo "[-----INFO-----] Starting peer node..."
osascript -e 'tell app "Terminal" to do script "docker run --name peer_container -p 19923:9923 -p 19922:9922 peer_node_img -it sh"'
echo "[-----INFO-----] Peer node started!"
echo "[-----INFO-----] Starting minter node..."
osascript -e 'tell app "Terminal" to do script "docker run --name minter_container -p 9923:9923 -p 9922:9922 minter_node_img -it sh"'
echo "[-----INFO-----] Minter node started!"