-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·46 lines (36 loc) · 1.19 KB
/
deploy.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
#!/bin/bash -e
mkdir -p $HOME/.reactor/db
mkdir -p $HOME/.reactor/logs
mkdir -p $HOME/.reactor/webui
if [[ ! -f docker-stack.yaml ]]; then
cd $HOME/.reactor/
wget https://raw.githubusercontent.com/tascape/reactor-report/master/docker-stack.yaml -O docker-stack.yaml
fi
removeStack() {
[[ $(docker stack rm reactor) ]] && sleep 10
while [[ $(docker network ls | grep reactor_reactor) ]]; do
sleep 5
done
}
waitForServices() {
docker service ls | grep reactor_report
ONLINE=0
echo -en "wait for services "
while [[ $ONLINE -ne 3 ]]; do
# docker service ls | grep reactor_report
sleep 2 && echo -n "."
ONLINE=$(docker service ls | grep reactor_report | grep "1/1" | wc -l)
done
echo ":)"
docker service ls | grep reactor_report
sleep 10
}
docker version || (echo "where is docker?"; exit 1)
removeStack
docker stack deploy -c docker-stack.yaml reactor
waitForServices
echo "reactor.db.type=mysql" >> $HOME/.reactor/reactor.properties
echo "reactor.db.host=localhost:33306" >> $HOME/.reactor/reactor.properties
echo "#reactor.log.path=$HOME/.reactor/logs" >> $HOME/.reactor/reactor.properties
echo "open report at http://127.0.0.1:30080/rr/"
open http://127.0.0.1:30080/rr/