-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster.sh
executable file
·70 lines (54 loc) · 993 Bytes
/
cluster.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
#!/bin/bash
set -e
wd=`pwd`
startNode() {
node=$1
./target/universal/stage/bin/chat \
-Dhttp.port=900$node \
-Dakka.remote.netty.tcp.port=255$node \
-Dpidfile.path=$wd/target/node$node.pid \
-Dnode.id=$node \
-Dakka.cluster.seed-nodes.1=akka.tcp://application@127.0.0.1:2552 \
-Dakka.cluster.seed-nodes.2=akka.tcp://application@127.0.0.1:2553 \
&
}
stopNode() {
pidfile=$wd/target/node$1.pid
if [ -e $pidfile ]
then
if kill -0 `cat $pidfile`
then
kill `cat $pidfile`
fi
rm $pidfile
fi
}
stop() {
stopNode 1
stopNode 2
stopNode 3
if [ -e target/nginx.pid ]
then
kill `cat target/nginx.pid`
fi
}
start() {
# Ensure the project is built
rm -rf /tmp/chat
sbt clean stage
startNode 1
startNode 2
startNode 3
nginx -p $wd -c nginx.conf &
}
case $1 in
restart)
stop ; start
;;
stop)
stop
;;
start)
start
;;
esac