-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_metersphere.sh
65 lines (65 loc) · 2.56 KB
/
install_metersphere.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
yum -y install PyYAML
service docker start
cd /opt/metersphere
case $1 in
server)
echo
export MS_INSTALL_MODE=server
sed -i "s/MS_EXTERNAL_KAFKA=false/MS_EXTERNAL_KAFKA=true/g" install.conf
sed -i "s/MS_INSTALL_MODE=allinone/MS_INSTALL_MODE=server/g" install.conf
sed -i "s/MS_EXTERNAL_PROMETHEUS=false/MS_EXTERNAL_PROMETHEUS=true/g" install.conf
sed -i "s/#kafka.bootstrap-servers=.*/kafka.bootstrap-servers=${2}:9092/g" conf/metersphere.properties
sed -i "/KAFKA_BOOTSTRAP-SERVERS.*/d" docker-compose-server.yml
python - <<EOF
import yaml
with open("docker-compose-server.yml", 'r') as file:
try:
compose=yaml.safe_load(file)
del compose["services"]["ms-data-streaming"]
except yaml.YAMLError as exc:
print(exc)
with open("docker-compose-server.yml", 'w') as file:
try:
file.write(yaml.dump(compose, default_flow_style=False))
except yaml.YAMLError as exc:
print(exc)
EOF
;;
node-controller)
echo
sed -i "s/MS_EXTERNAL_KAFKA=false/MS_EXTERNAL_KAFKA=true/g" install.conf
sed -i "s/MS_EXTERNAL_MYSQL=false/MS_EXTERNAL_MYSQL=true/g" install.conf
sed -i "s/MS_EXTERNAL_PROMETHEUS=false/MS_EXTERNAL_PROMETHEUS=true/g" install.conf
sed -i "s/MS_INSTALL_MODE=allinone/MS_INSTALL_MODE=node-controller/g" install.conf
sed -i "s/#kafka.bootstrap-servers=.*/kafka.bootstrap-servers=${2}:9092/g" conf/metersphere.properties
sed -i "/KAFKA_BOOTSTRAP-SERVERS.*/d" docker-compose-node-controller.yml
;;
data-streaming)
echo
sed -i "s/MS_EXTERNAL_KAFKA=false/MS_EXTERNAL_KAFKA=true/g" install.conf
sed -i "s/MS_EXTERNAL_MYSQL=false/MS_EXTERNAL_MYSQL=true/g" install.conf
sed -i "s/MS_MYSQL_HOST=mysql/MS_MYSQL_HOST=${3}/g" install.conf
sed -i "s/MS_MYSQL_PORT=3306/MS_MYSQL_PORT=3307/g" install.conf
sed -i "s/MS_EXTERNAL_PROMETHEUS=false/MS_EXTERNAL_PROMETHEUS=true/g" install.conf
sed -i "s/MS_INSTALL_MODE=allinone/MS_INSTALL_MODE=server/g" install.conf
sed -i "/KAFKA_BOOTSTRAP-SERVERS.*/d" docker-compose-server.yml
sed -i "s/#kafka.bootstrap-servers=.*/kafka.bootstrap-servers=${2}:9092/g" conf/metersphere.properties
python - <<EOF
import yaml
with open("docker-compose-server.yml", 'r') as file:
try:
compose=yaml.safe_load(file)
del compose["services"]["ms-server"]
except yaml.YAMLError as exc:
print(exc)
with open("docker-compose-server.yml", 'w') as file:
try:
file.write(yaml.dump(compose, default_flow_style=False))
except yaml.YAMLError as exc:
print(exc)
EOF
;;
esac
sleep 5
msctl reload
msctl reload