This repository has been archived by the owner on Feb 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsetup.sh
executable file
·97 lines (84 loc) · 2.74 KB
/
setup.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
97
#!/bin/bash
#======================================================================================================================
#
# FILE: setup.sh
#
# DESCRIPTION: Install
#
# BUGS: https://github.com/goodrain/rainbond-install/issues
#
# COPYRIGHT: (c) 2018 by the Goodrain Delivery Team.
#
# LICENSE: Apache 2.0
# CREATED: 03/30/2018 10:49:37 AM
#======================================================================================================================
[[ $DEBUG ]] && set -x
export MAIN_CONFIG="/srv/pillar/rainbond.sls"
[ ! -d "/srv/pillar/" ] && (
mkdir -p /srv/pillar/
cp rainbond.yaml.default ${MAIN_CONFIG}
)
. scripts/common.sh
# trap program exit
trap 'Exit_Clear; exit' SIGINT SIGHUP
clear
# -----------------------------------------------------------------------------
# checking the availability of system
Echo_Banner "Rainbond v$RBD_VERSION"
check_func(){
Echo_Info "Check func."
./scripts/check.sh $@
}
init_config(){
if [ ! -f $INIT_FILE ];then
Echo_Info "Init rainbond configure."
./scripts/init_sls.sh && touch $INIT_FILE
fi
}
install_func(){
fail_num=0
step_num=1
all_steps=$(echo ${MANAGE_MODULES} | tr ' ' '\n' | wc -l)
Echo_Info "will install manage node.It will take 15-30 minutes to install"
for module in ${MANAGE_MODULES}
do
if [ "$module" = "plugins" -o "$module" = "proxy" ];then
Echo_Info "Start install $module(step: $step_num/$all_steps), it will take 3-8 minutes "
else
Echo_Info "Start install $module(step: $step_num/$all_steps) ..."
fi
if ! (salt "*" state.sls $module);then
((fail_num+=1))
break
fi
((step_num++))
sleep 1
done
if [ "$fail_num" -eq 0 ];then
if $( grep 'install-type: online' /srv/pillar/rainbond.sls >/dev/null );then
REG_Status || return 0
systemctl restart node
fi
uuid=$(salt '*' grains.get uuid | grep "-" | awk '{print $1}')
notready=$(grctl node list | grep $uuid | grep false)
if [ "$notready" != "" ];then
grctl node up $uuid
fi
Echo_Info "install successfully"
public_ip=$(yq r /srv/pillar/rainbond.sls master-public-ip)
private_ip=$(yq r /srv/pillar/rainbond.sls master-private-ip)
if [ ! -z "$public_ip" ];then
Echo_Banner "http://${public_ip}:7070"
else
Echo_Banner "http://${private_ip}:7070"
fi
else
Echo_Info "install help"
Echo_Info "https://www.rainbond.com/docs/stable/operation-manual/trouble-shooting/install-issue.html"
fi
}
case $1 in
*)
check_func && init_config && install_func ${@:2}
;;
esac