-
Notifications
You must be signed in to change notification settings - Fork 73
/
deploy.sh
142 lines (126 loc) · 2.38 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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/sh
# 使用说明,用来提示输入参数
usage() {
echo "Usage: sh deploy.sh [port|base|modules|stop|rm]"
exit 1
}
# 开启所需端口(服务器是centos系统)
#port(){
# # Nginx
# firewall-cmd --add-port=80/tcp --permanent
# # Gateway
# firewall-cmd --add-port=6880/tcp --permanent
# # Auth
# firewall-cmd --add-port=6800/tcp --permanent
# # System
# firewall-cmd --add-port=6801/tcp --permanent
# # gen
# firewall-cmd --add-port=6802/tcp --permanent
# # job
# firewall-cmd --add-port=6803/tcp --permanent
# # project
# firewall-cmd --add-port=6806/tcp --permanent
# # workflow
# firewall-cmd --add-port=6808/tcp --permanent
# # monitor
# firewall-cmd --add-port=6888/tcp --permanent
# # MySQL
# firewall-cmd --add-port=33706/tcp --permanent
# # Redis
# firewall-cmd --add-port=6379/tcp --permanent
# # Nacos
# firewall-cmd --add-port=8848/tcp --permanent
# firewall-cmd --add-port=9848/tcp --permanent
# firewall-cmd --add-port=9849/tcp --permanent
# service firewalld restart
#}
# 开启所需端口(服务器是Debian系统)
port(){
# Nginx
ufw allow 80/tcp
# Gateway
ufw allow 6880/tcp
# Auth
ufw allow 6800/tcp
# System
ufw allow 6801/tcp
# gen
ufw allow 6802/tcp
# job
ufw allow 6803/tcp
# project
ufw allow 6806/tcp
# workflow
ufw allow 6808/tcp
# monitor
ufw allow 6888/tcp
# MySQL
ufw allow 33706/tcp
# Redis
ufw allow 6379/tcp
# Nacos
ufw allow 8848/tcp
ufw allow 9848/tcp
ufw allow 9849/tcp
# 重启防火墙
service ufw restart
# 必须:在云后台开启安全组对应端口
}
# 启动基础环境(必须)
base(){
docker-compose up -d pmhub-mysql pmhub-redis pmhub-nacos
}
# 启动重要服务(必须)
important(){
docker-compose up -d pmhub-gateway pmhub-auth
}
# 启动程序模块(必须)
modules(){
docker-compose up -d pmhub-system pmhub-project pmhub-workflow
}
# 启动不重要服务(非必须)
unimportant(){
docker-compose up -d pmhub-gen pmhub-job pmhub-monitor
}
# 关闭所有环境/模块
stop(){
docker-compose stop
}
# 重新构建镜像
build(){
docker-compose up --build -d
}
# 删除所有环境/模块
rm(){
docker-compose rm
}
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
case "$1" in
"port")
port
;;
"base")
base
;;
"important")
important
;;
"modules")
modules
;;
"unimportant")
unimportant
;;
"stop")
stop
;;
"stop")
build
;;
"rm")
rm
;;
*)
usage
;;
esac