@wjwjq/release-helper 0.0.7 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deploy/pkg/nginx_binary/compile.sh +37 -0
- package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.0.2.tar.gz +0 -0
- package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.1.1.tar.gz +0 -0
- package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl3.0.7.tar.gz +0 -0
- package/dist/deploy/script/common.sh +30 -1
- package/dist/deploy/script/install.sh +0 -44
- package/dist/deploy/script/nginx.sh +88 -5
- package/dist/deploy/script/upgrade.sh +0 -43
- package/package.json +2 -2
- package/src/deploy/pkg/nginx_binary/compile.sh +37 -0
- package/src/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.0.2.tar.gz +0 -0
- package/src/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.1.1.tar.gz +0 -0
- package/src/deploy/pkg/nginx_binary/nginx-x86_64-ssl3.0.7.tar.gz +0 -0
- package/src/deploy/script/common.sh +30 -1
- package/src/deploy/script/install.sh +0 -44
- package/src/deploy/script/nginx.sh +88 -5
- package/src/deploy/script/upgrade.sh +0 -43
- package/dist/deploy/nginx/README.md +0 -1
- package/dist/deploy/nginx/pkg/nginx-x86_64-ssl1.0.2.tar.gz +0 -0
- package/dist/deploy/nginx/pkg/nginx-x86_64-ssl1.1.1.tar.gz +0 -0
- package/dist/deploy/nginx/pkg/nginx-x86_64-ssl3.0.7.tar.gz +0 -0
- package/dist/deploy/nginx/script/common.sh +0 -178
- package/dist/deploy/nginx/script/compile.sh +0 -11
- package/dist/deploy/nginx/script/fix.sh +0 -24
- package/dist/deploy/nginx/script/https.sh +0 -79
- package/dist/deploy/nginx/script/install.sh +0 -95
- package/dist/deploy/nginx/script/prompt.sh +0 -10
- package/dist/deploy/nginx/script/upgrade.sh +0 -7
- package/src/deploy/nginx/README.md +0 -1
- package/src/deploy/nginx/pkg/nginx-x86_64-ssl1.0.2.tar.gz +0 -0
- package/src/deploy/nginx/pkg/nginx-x86_64-ssl1.1.1.tar.gz +0 -0
- package/src/deploy/nginx/pkg/nginx-x86_64-ssl3.0.7.tar.gz +0 -0
- package/src/deploy/nginx/script/common.sh +0 -178
- package/src/deploy/nginx/script/compile.sh +0 -11
- package/src/deploy/nginx/script/fix.sh +0 -24
- package/src/deploy/nginx/script/https.sh +0 -79
- package/src/deploy/nginx/script/install.sh +0 -95
- package/src/deploy/nginx/script/prompt.sh +0 -10
- package/src/deploy/nginx/script/upgrade.sh +0 -7
- /package/dist/deploy/{nginx/pkg → pkg/nginx_binary}/nginx-arm-ssl1.1.1.tar.gz +0 -0
- /package/src/deploy/{nginx/pkg → pkg/nginx_binary}/nginx-arm-ssl1.1.1.tar.gz +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# current nginx source code version 1.22.1
|
|
3
|
+
|
|
4
|
+
./configure \
|
|
5
|
+
--prefix=/etc/nginx \
|
|
6
|
+
--conf-path=/etc/nginx/nginx.conf \
|
|
7
|
+
--error-log-path=/var/log/nginx/error.log \
|
|
8
|
+
--http-log-path=/var/log/nginx/access.log \
|
|
9
|
+
--pid-path=/var/run/nginx/nginx.pid \
|
|
10
|
+
--lock-path=/var/run/nginx/nginx.lock \
|
|
11
|
+
--with-http_ssl_module \
|
|
12
|
+
--with-http_v2_module \
|
|
13
|
+
--with-http_gzip_static_module \
|
|
14
|
+
--with-http_stub_status_module \
|
|
15
|
+
--with-stream \
|
|
16
|
+
--with-pcre
|
|
17
|
+
|
|
18
|
+
make
|
|
19
|
+
|
|
20
|
+
make install
|
|
21
|
+
|
|
22
|
+
echo '------------------compile and install done----------------------------'
|
|
23
|
+
|
|
24
|
+
arch=$(uname -m)
|
|
25
|
+
ssl_version=$(openssl version | grep -oP '\d+\.\d+' | sed -n '1p' 2>&1)
|
|
26
|
+
|
|
27
|
+
if [[ -z "${arch}" ]]; then
|
|
28
|
+
arch="x86_64"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
if [[ -z "${ssl_version}" ]]; then
|
|
32
|
+
ssl_version="1.0.2"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
tar -zcvf nginx-"$arch"-ssl"$ssl_version".tar.gz /etc/nginx/ -C /root
|
|
36
|
+
|
|
37
|
+
echo "-----------pack at: /root nginx-"$arch"-ssl"$ssl_version".tar.gz--------------"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -133,7 +133,36 @@ install_assets() {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
start() {
|
|
136
|
-
|
|
136
|
+
# 未安装
|
|
137
|
+
if ((has_nginx_installed == 0)); then
|
|
138
|
+
install_nginx_binary
|
|
139
|
+
|
|
140
|
+
if [[ $? != 0 ]]; then
|
|
141
|
+
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
142
|
+
exit 1
|
|
143
|
+
fi
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# 已安装 询问是否更新nginx
|
|
147
|
+
if ((has_nginx_installed == 1)); then
|
|
148
|
+
while true; do
|
|
149
|
+
read -r -p "Nginx has been installed, re-install it?[Y/N]" yn
|
|
150
|
+
case $yn in
|
|
151
|
+
[Yy]*)
|
|
152
|
+
install_nginx_binary
|
|
153
|
+
|
|
154
|
+
if [[ $? != 0 ]]; then
|
|
155
|
+
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
156
|
+
exit 1
|
|
157
|
+
fi
|
|
158
|
+
break
|
|
159
|
+
;;
|
|
160
|
+
[Nn]*) break ;;
|
|
161
|
+
*) echo "Please answer yes or no." ;;
|
|
162
|
+
esac
|
|
163
|
+
done
|
|
164
|
+
fi
|
|
165
|
+
|
|
137
166
|
# 创建用户
|
|
138
167
|
create_user_csri
|
|
139
168
|
|
|
@@ -4,48 +4,4 @@ basepath=$(dirname "$(realpath "${BASH_SOURCE[-1]}")")
|
|
|
4
4
|
|
|
5
5
|
source "$basepath"/common.sh
|
|
6
6
|
|
|
7
|
-
# 未安装
|
|
8
|
-
if ((has_nginx_installed == 0)); then
|
|
9
|
-
# while true; do
|
|
10
|
-
# read -r -p "Nginx not found, install it?[Y/N]" yn
|
|
11
|
-
# case $yn in
|
|
12
|
-
# [Yy]*)
|
|
13
|
-
# chmod +x "$basepath"/../nginx/script/install.sh
|
|
14
|
-
# sh "$basepath"/../nginx/script/install.sh
|
|
15
|
-
# break
|
|
16
|
-
# ;;
|
|
17
|
-
# [Nn]*) exit ;;
|
|
18
|
-
# *) echo "Please answer yes or no." ;;
|
|
19
|
-
# esac
|
|
20
|
-
# done
|
|
21
|
-
chmod +x "$basepath"/../nginx/script/install.sh
|
|
22
|
-
sh "$basepath"/../nginx/script/install.sh
|
|
23
|
-
|
|
24
|
-
if [[ $? != 0 ]]; then
|
|
25
|
-
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
26
|
-
exit 1
|
|
27
|
-
fi
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# 已安装 询问是否更新nginx
|
|
31
|
-
if ((has_nginx_installed == 1)); then
|
|
32
|
-
while true; do
|
|
33
|
-
read -r -p "Nginx has been installed, re-install it?[Y/N]" yn
|
|
34
|
-
case $yn in
|
|
35
|
-
[Yy]*)
|
|
36
|
-
chmod +x "$basepath"/../nginx/script/install.sh
|
|
37
|
-
sh "$basepath"/../nginx/script/install.sh "${@}"
|
|
38
|
-
|
|
39
|
-
if [[ $? != 0 ]]; then
|
|
40
|
-
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
41
|
-
exit 1
|
|
42
|
-
fi
|
|
43
|
-
break
|
|
44
|
-
;;
|
|
45
|
-
[Nn]*) break ;;
|
|
46
|
-
*) echo "Please answer yes or no." ;;
|
|
47
|
-
esac
|
|
48
|
-
done
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
7
|
start
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# 指定安装目录
|
|
3
|
-
# nginx_conf_install_path="$prefix/etc/nginx_instances/${app_name}/"
|
|
4
|
-
nginx_conf_install_path="$prefix/opt/${app_name}/nginx/"
|
|
5
2
|
|
|
6
3
|
# 安装包所在路径
|
|
7
4
|
pkg_path="${project_path}/pkg"
|
|
8
5
|
|
|
6
|
+
#------------------------------------ nginx服务配置文件服务 start----------------------------------
|
|
9
7
|
# 配置文件所在路径
|
|
10
8
|
new_nginx_conf_path="${pkg_path}/nginx"
|
|
11
9
|
|
|
10
|
+
# 指定安装目录
|
|
11
|
+
nginx_conf_install_path="$prefix/opt/${app_name}/nginx/"
|
|
12
|
+
|
|
12
13
|
# nginx服务配置文件路径
|
|
13
14
|
nginx_conf_path="${nginx_conf_install_path}nginx.conf"
|
|
14
15
|
|
|
@@ -21,8 +22,6 @@ nginx_pid_file_path="$nginx_pid_dir${app_name}.nginx.pid"
|
|
|
21
22
|
conf_version=$(awk '{print $1}' "${pkg_path}"/version)
|
|
22
23
|
echo "$conf_version"
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
25
|
copy_nginx_conf_and_write_verison() {
|
|
27
26
|
mkdir -p "$nginx_conf_install_path"
|
|
28
27
|
# 创建pid目录
|
|
@@ -32,6 +31,7 @@ copy_nginx_conf_and_write_verison() {
|
|
|
32
31
|
|
|
33
32
|
# 创建日志目录
|
|
34
33
|
mkdir -p $nginx_log_path
|
|
34
|
+
touch $nginx_log_path/$nginx_log_file
|
|
35
35
|
chown -R $user:$usergroup $nginx_log_path
|
|
36
36
|
chmod 744 -R $nginx_log_path
|
|
37
37
|
|
|
@@ -170,3 +170,86 @@ add_nginx_service() {
|
|
|
170
170
|
rm -rf /usr/lib/systemd/system/"$app_name".nginx.service
|
|
171
171
|
fi
|
|
172
172
|
}
|
|
173
|
+
#------------------------------------ nginx服务配置文件服务 end----------------------------------
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
#------------------------------------ nginx 可执行程序相关 start----------------------------------
|
|
177
|
+
# 指定安装目录
|
|
178
|
+
nginx_binary_install_path="/etc/nginx/"
|
|
179
|
+
|
|
180
|
+
mkdir -p "$nginx_binary_install_path"
|
|
181
|
+
|
|
182
|
+
# 安装包所在路径
|
|
183
|
+
nginx_binary_pkg_path="${pkg_path}/nginx_binary"
|
|
184
|
+
|
|
185
|
+
open_port_80() {
|
|
186
|
+
# 查看防火墙是否开启
|
|
187
|
+
systemctl status firewalld
|
|
188
|
+
# 若未开启则开启
|
|
189
|
+
systemctl start firewalld
|
|
190
|
+
|
|
191
|
+
# 查看所有开启的端口
|
|
192
|
+
#firewall-cmd --list-ports
|
|
193
|
+
|
|
194
|
+
# 开启nginx默认80端口(关键步骤一)
|
|
195
|
+
firewall-cmd --zone=public --add-port=80/tcp --permanent
|
|
196
|
+
|
|
197
|
+
# 重启防火墙(关键步骤二)
|
|
198
|
+
firewall-cmd --reload
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
# 安装nginx可执行程序
|
|
202
|
+
install_nginx_binary() {
|
|
203
|
+
log "install nginx to path: ${nginx_binary_install_path}"
|
|
204
|
+
|
|
205
|
+
arch=$(uname -m)
|
|
206
|
+
ssl_version=$(openssl version | grep -oP '\d+\.\d+' | sed -n '1p' 2>&1)
|
|
207
|
+
|
|
208
|
+
if [[ -z "${arch}" ]]; then
|
|
209
|
+
arch="x86_64"
|
|
210
|
+
fi
|
|
211
|
+
|
|
212
|
+
if [[ $arch == arm* ]] || [[ $arch = aarch64 ]]; then
|
|
213
|
+
arch="arm"
|
|
214
|
+
fi
|
|
215
|
+
|
|
216
|
+
if [[ "${ssl_version}" == "1.0" ]]; then
|
|
217
|
+
ssl_version="1.0.2"
|
|
218
|
+
fi
|
|
219
|
+
|
|
220
|
+
if [[ "${ssl_version}" == "1.1" ]]; then
|
|
221
|
+
ssl_version="1.1.1"
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
if [[ "${ssl_version}" == "3.0" ]]; then
|
|
225
|
+
ssl_version="3.0.7"
|
|
226
|
+
fi
|
|
227
|
+
|
|
228
|
+
if [[ -z "${ssl_version}" ]]; then
|
|
229
|
+
ssl_version="1.0.2"
|
|
230
|
+
fi
|
|
231
|
+
|
|
232
|
+
pkg="$nginx_binary_pkg_path"/nginx-"$arch"-ssl"$ssl_version".tar.gz
|
|
233
|
+
|
|
234
|
+
if [ ! -f "$pkg" ]; then
|
|
235
|
+
log_error "Fatal error: nginx-$arch-ssl$ssl_version.tar.gz not matched! contact developer!"
|
|
236
|
+
exit 1
|
|
237
|
+
fi
|
|
238
|
+
|
|
239
|
+
log "current arch: $arch, current ssl_version: $ssl_version"
|
|
240
|
+
|
|
241
|
+
tar -zxvhf "$pkg" -C "$nginx_binary_install_path" --strip-components 1
|
|
242
|
+
# 检测是否安装成功
|
|
243
|
+
if [[ $? == 0 ]]; then
|
|
244
|
+
log_success "nginx installation successfully!"
|
|
245
|
+
else
|
|
246
|
+
log_error "nginx installation failed!"
|
|
247
|
+
fi
|
|
248
|
+
|
|
249
|
+
cp "$nginx_binary_install_path"sbin/nginx /usr/sbin/
|
|
250
|
+
|
|
251
|
+
# 修改/etc/nginx 用户(组)
|
|
252
|
+
chown -R $user:$usergroup "$nginx_binary_install_path"
|
|
253
|
+
chmod 744 -R "$nginx_binary_install_path"
|
|
254
|
+
}
|
|
255
|
+
#------------------------------------ nginx 可执行程序相关 end ----------------------------------
|
|
@@ -4,47 +4,4 @@ basepath=$(dirname "$(realpath "${BASH_SOURCE[-1]}")")
|
|
|
4
4
|
|
|
5
5
|
source "$basepath"/common.sh
|
|
6
6
|
|
|
7
|
-
# 未安装
|
|
8
|
-
if ((has_nginx_installed == 0)); then
|
|
9
|
-
# while true; do
|
|
10
|
-
# read -r -p "Nginx not found, install it?[Y/N]" yn
|
|
11
|
-
# case $yn in
|
|
12
|
-
# [Yy]*)
|
|
13
|
-
# chmod +x "$basepath"/../nginx/script/install.sh
|
|
14
|
-
# sh "$basepath"/../nginx/script/install.sh
|
|
15
|
-
# break
|
|
16
|
-
# ;;
|
|
17
|
-
# [Nn]*) exit ;;
|
|
18
|
-
# *) echo "Please answer yes or no." ;;
|
|
19
|
-
# esac
|
|
20
|
-
# done
|
|
21
|
-
chmod +x "$basepath"/../nginx/script/install.sh
|
|
22
|
-
sh "$basepath"/../nginx/script/install.sh "${@}"
|
|
23
|
-
|
|
24
|
-
if [[ $? != 0 ]]; then
|
|
25
|
-
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
26
|
-
exit 1
|
|
27
|
-
fi
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# 已安装 询问是否更新nginx
|
|
31
|
-
if ((has_nginx_installed == 1)); then
|
|
32
|
-
while true; do
|
|
33
|
-
read -r -p "Nginx has been installed, re-install it?[Y/N]" yn
|
|
34
|
-
case $yn in
|
|
35
|
-
[Yy]*)
|
|
36
|
-
chmod +x "$basepath"/../nginx/script/install.sh
|
|
37
|
-
sh "$basepath"/../nginx/script/install.sh "${@}"
|
|
38
|
-
if [[ $? != 0 ]]; then
|
|
39
|
-
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
40
|
-
exit 1
|
|
41
|
-
fi
|
|
42
|
-
break
|
|
43
|
-
;;
|
|
44
|
-
[Nn]*) break ;;
|
|
45
|
-
*) echo "Please answer yes or no." ;;
|
|
46
|
-
esac
|
|
47
|
-
done
|
|
48
|
-
fi
|
|
49
|
-
|
|
50
7
|
start
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wjwjq/release-helper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "generate deployment package for frontend, include nginx...",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"scripts": {
|
|
66
66
|
"localpack": "pnpm link --global",
|
|
67
67
|
"postinstall": "node dist/start_prepare.js",
|
|
68
|
-
"build": "rollup -c",
|
|
68
|
+
"build": "rm -rf dist && rollup -c",
|
|
69
69
|
"prepublish": "pnpm build"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# current nginx source code version 1.22.1
|
|
3
|
+
|
|
4
|
+
./configure \
|
|
5
|
+
--prefix=/etc/nginx \
|
|
6
|
+
--conf-path=/etc/nginx/nginx.conf \
|
|
7
|
+
--error-log-path=/var/log/nginx/error.log \
|
|
8
|
+
--http-log-path=/var/log/nginx/access.log \
|
|
9
|
+
--pid-path=/var/run/nginx/nginx.pid \
|
|
10
|
+
--lock-path=/var/run/nginx/nginx.lock \
|
|
11
|
+
--with-http_ssl_module \
|
|
12
|
+
--with-http_v2_module \
|
|
13
|
+
--with-http_gzip_static_module \
|
|
14
|
+
--with-http_stub_status_module \
|
|
15
|
+
--with-stream \
|
|
16
|
+
--with-pcre
|
|
17
|
+
|
|
18
|
+
make
|
|
19
|
+
|
|
20
|
+
make install
|
|
21
|
+
|
|
22
|
+
echo '------------------compile and install done----------------------------'
|
|
23
|
+
|
|
24
|
+
arch=$(uname -m)
|
|
25
|
+
ssl_version=$(openssl version | grep -oP '\d+\.\d+' | sed -n '1p' 2>&1)
|
|
26
|
+
|
|
27
|
+
if [[ -z "${arch}" ]]; then
|
|
28
|
+
arch="x86_64"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
if [[ -z "${ssl_version}" ]]; then
|
|
32
|
+
ssl_version="1.0.2"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
tar -zcvf nginx-"$arch"-ssl"$ssl_version".tar.gz /etc/nginx/ -C /root
|
|
36
|
+
|
|
37
|
+
echo "-----------pack at: /root nginx-"$arch"-ssl"$ssl_version".tar.gz--------------"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -133,7 +133,36 @@ install_assets() {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
start() {
|
|
136
|
-
|
|
136
|
+
# 未安装
|
|
137
|
+
if ((has_nginx_installed == 0)); then
|
|
138
|
+
install_nginx_binary
|
|
139
|
+
|
|
140
|
+
if [[ $? != 0 ]]; then
|
|
141
|
+
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
142
|
+
exit 1
|
|
143
|
+
fi
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# 已安装 询问是否更新nginx
|
|
147
|
+
if ((has_nginx_installed == 1)); then
|
|
148
|
+
while true; do
|
|
149
|
+
read -r -p "Nginx has been installed, re-install it?[Y/N]" yn
|
|
150
|
+
case $yn in
|
|
151
|
+
[Yy]*)
|
|
152
|
+
install_nginx_binary
|
|
153
|
+
|
|
154
|
+
if [[ $? != 0 ]]; then
|
|
155
|
+
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
156
|
+
exit 1
|
|
157
|
+
fi
|
|
158
|
+
break
|
|
159
|
+
;;
|
|
160
|
+
[Nn]*) break ;;
|
|
161
|
+
*) echo "Please answer yes or no." ;;
|
|
162
|
+
esac
|
|
163
|
+
done
|
|
164
|
+
fi
|
|
165
|
+
|
|
137
166
|
# 创建用户
|
|
138
167
|
create_user_csri
|
|
139
168
|
|
|
@@ -4,48 +4,4 @@ basepath=$(dirname "$(realpath "${BASH_SOURCE[-1]}")")
|
|
|
4
4
|
|
|
5
5
|
source "$basepath"/common.sh
|
|
6
6
|
|
|
7
|
-
# 未安装
|
|
8
|
-
if ((has_nginx_installed == 0)); then
|
|
9
|
-
# while true; do
|
|
10
|
-
# read -r -p "Nginx not found, install it?[Y/N]" yn
|
|
11
|
-
# case $yn in
|
|
12
|
-
# [Yy]*)
|
|
13
|
-
# chmod +x "$basepath"/../nginx/script/install.sh
|
|
14
|
-
# sh "$basepath"/../nginx/script/install.sh
|
|
15
|
-
# break
|
|
16
|
-
# ;;
|
|
17
|
-
# [Nn]*) exit ;;
|
|
18
|
-
# *) echo "Please answer yes or no." ;;
|
|
19
|
-
# esac
|
|
20
|
-
# done
|
|
21
|
-
chmod +x "$basepath"/../nginx/script/install.sh
|
|
22
|
-
sh "$basepath"/../nginx/script/install.sh
|
|
23
|
-
|
|
24
|
-
if [[ $? != 0 ]]; then
|
|
25
|
-
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
26
|
-
exit 1
|
|
27
|
-
fi
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# 已安装 询问是否更新nginx
|
|
31
|
-
if ((has_nginx_installed == 1)); then
|
|
32
|
-
while true; do
|
|
33
|
-
read -r -p "Nginx has been installed, re-install it?[Y/N]" yn
|
|
34
|
-
case $yn in
|
|
35
|
-
[Yy]*)
|
|
36
|
-
chmod +x "$basepath"/../nginx/script/install.sh
|
|
37
|
-
sh "$basepath"/../nginx/script/install.sh "${@}"
|
|
38
|
-
|
|
39
|
-
if [[ $? != 0 ]]; then
|
|
40
|
-
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
41
|
-
exit 1
|
|
42
|
-
fi
|
|
43
|
-
break
|
|
44
|
-
;;
|
|
45
|
-
[Nn]*) break ;;
|
|
46
|
-
*) echo "Please answer yes or no." ;;
|
|
47
|
-
esac
|
|
48
|
-
done
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
7
|
start
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# 指定安装目录
|
|
3
|
-
# nginx_conf_install_path="$prefix/etc/nginx_instances/${app_name}/"
|
|
4
|
-
nginx_conf_install_path="$prefix/opt/${app_name}/nginx/"
|
|
5
2
|
|
|
6
3
|
# 安装包所在路径
|
|
7
4
|
pkg_path="${project_path}/pkg"
|
|
8
5
|
|
|
6
|
+
#------------------------------------ nginx服务配置文件服务 start----------------------------------
|
|
9
7
|
# 配置文件所在路径
|
|
10
8
|
new_nginx_conf_path="${pkg_path}/nginx"
|
|
11
9
|
|
|
10
|
+
# 指定安装目录
|
|
11
|
+
nginx_conf_install_path="$prefix/opt/${app_name}/nginx/"
|
|
12
|
+
|
|
12
13
|
# nginx服务配置文件路径
|
|
13
14
|
nginx_conf_path="${nginx_conf_install_path}nginx.conf"
|
|
14
15
|
|
|
@@ -21,8 +22,6 @@ nginx_pid_file_path="$nginx_pid_dir${app_name}.nginx.pid"
|
|
|
21
22
|
conf_version=$(awk '{print $1}' "${pkg_path}"/version)
|
|
22
23
|
echo "$conf_version"
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
25
|
copy_nginx_conf_and_write_verison() {
|
|
27
26
|
mkdir -p "$nginx_conf_install_path"
|
|
28
27
|
# 创建pid目录
|
|
@@ -32,6 +31,7 @@ copy_nginx_conf_and_write_verison() {
|
|
|
32
31
|
|
|
33
32
|
# 创建日志目录
|
|
34
33
|
mkdir -p $nginx_log_path
|
|
34
|
+
touch $nginx_log_path/$nginx_log_file
|
|
35
35
|
chown -R $user:$usergroup $nginx_log_path
|
|
36
36
|
chmod 744 -R $nginx_log_path
|
|
37
37
|
|
|
@@ -170,3 +170,86 @@ add_nginx_service() {
|
|
|
170
170
|
rm -rf /usr/lib/systemd/system/"$app_name".nginx.service
|
|
171
171
|
fi
|
|
172
172
|
}
|
|
173
|
+
#------------------------------------ nginx服务配置文件服务 end----------------------------------
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
#------------------------------------ nginx 可执行程序相关 start----------------------------------
|
|
177
|
+
# 指定安装目录
|
|
178
|
+
nginx_binary_install_path="/etc/nginx/"
|
|
179
|
+
|
|
180
|
+
mkdir -p "$nginx_binary_install_path"
|
|
181
|
+
|
|
182
|
+
# 安装包所在路径
|
|
183
|
+
nginx_binary_pkg_path="${pkg_path}/nginx_binary"
|
|
184
|
+
|
|
185
|
+
open_port_80() {
|
|
186
|
+
# 查看防火墙是否开启
|
|
187
|
+
systemctl status firewalld
|
|
188
|
+
# 若未开启则开启
|
|
189
|
+
systemctl start firewalld
|
|
190
|
+
|
|
191
|
+
# 查看所有开启的端口
|
|
192
|
+
#firewall-cmd --list-ports
|
|
193
|
+
|
|
194
|
+
# 开启nginx默认80端口(关键步骤一)
|
|
195
|
+
firewall-cmd --zone=public --add-port=80/tcp --permanent
|
|
196
|
+
|
|
197
|
+
# 重启防火墙(关键步骤二)
|
|
198
|
+
firewall-cmd --reload
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
# 安装nginx可执行程序
|
|
202
|
+
install_nginx_binary() {
|
|
203
|
+
log "install nginx to path: ${nginx_binary_install_path}"
|
|
204
|
+
|
|
205
|
+
arch=$(uname -m)
|
|
206
|
+
ssl_version=$(openssl version | grep -oP '\d+\.\d+' | sed -n '1p' 2>&1)
|
|
207
|
+
|
|
208
|
+
if [[ -z "${arch}" ]]; then
|
|
209
|
+
arch="x86_64"
|
|
210
|
+
fi
|
|
211
|
+
|
|
212
|
+
if [[ $arch == arm* ]] || [[ $arch = aarch64 ]]; then
|
|
213
|
+
arch="arm"
|
|
214
|
+
fi
|
|
215
|
+
|
|
216
|
+
if [[ "${ssl_version}" == "1.0" ]]; then
|
|
217
|
+
ssl_version="1.0.2"
|
|
218
|
+
fi
|
|
219
|
+
|
|
220
|
+
if [[ "${ssl_version}" == "1.1" ]]; then
|
|
221
|
+
ssl_version="1.1.1"
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
if [[ "${ssl_version}" == "3.0" ]]; then
|
|
225
|
+
ssl_version="3.0.7"
|
|
226
|
+
fi
|
|
227
|
+
|
|
228
|
+
if [[ -z "${ssl_version}" ]]; then
|
|
229
|
+
ssl_version="1.0.2"
|
|
230
|
+
fi
|
|
231
|
+
|
|
232
|
+
pkg="$nginx_binary_pkg_path"/nginx-"$arch"-ssl"$ssl_version".tar.gz
|
|
233
|
+
|
|
234
|
+
if [ ! -f "$pkg" ]; then
|
|
235
|
+
log_error "Fatal error: nginx-$arch-ssl$ssl_version.tar.gz not matched! contact developer!"
|
|
236
|
+
exit 1
|
|
237
|
+
fi
|
|
238
|
+
|
|
239
|
+
log "current arch: $arch, current ssl_version: $ssl_version"
|
|
240
|
+
|
|
241
|
+
tar -zxvhf "$pkg" -C "$nginx_binary_install_path" --strip-components 1
|
|
242
|
+
# 检测是否安装成功
|
|
243
|
+
if [[ $? == 0 ]]; then
|
|
244
|
+
log_success "nginx installation successfully!"
|
|
245
|
+
else
|
|
246
|
+
log_error "nginx installation failed!"
|
|
247
|
+
fi
|
|
248
|
+
|
|
249
|
+
cp "$nginx_binary_install_path"sbin/nginx /usr/sbin/
|
|
250
|
+
|
|
251
|
+
# 修改/etc/nginx 用户(组)
|
|
252
|
+
chown -R $user:$usergroup "$nginx_binary_install_path"
|
|
253
|
+
chmod 744 -R "$nginx_binary_install_path"
|
|
254
|
+
}
|
|
255
|
+
#------------------------------------ nginx 可执行程序相关 end ----------------------------------
|
|
@@ -4,47 +4,4 @@ basepath=$(dirname "$(realpath "${BASH_SOURCE[-1]}")")
|
|
|
4
4
|
|
|
5
5
|
source "$basepath"/common.sh
|
|
6
6
|
|
|
7
|
-
# 未安装
|
|
8
|
-
if ((has_nginx_installed == 0)); then
|
|
9
|
-
# while true; do
|
|
10
|
-
# read -r -p "Nginx not found, install it?[Y/N]" yn
|
|
11
|
-
# case $yn in
|
|
12
|
-
# [Yy]*)
|
|
13
|
-
# chmod +x "$basepath"/../nginx/script/install.sh
|
|
14
|
-
# sh "$basepath"/../nginx/script/install.sh
|
|
15
|
-
# break
|
|
16
|
-
# ;;
|
|
17
|
-
# [Nn]*) exit ;;
|
|
18
|
-
# *) echo "Please answer yes or no." ;;
|
|
19
|
-
# esac
|
|
20
|
-
# done
|
|
21
|
-
chmod +x "$basepath"/../nginx/script/install.sh
|
|
22
|
-
sh "$basepath"/../nginx/script/install.sh "${@}"
|
|
23
|
-
|
|
24
|
-
if [[ $? != 0 ]]; then
|
|
25
|
-
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
26
|
-
exit 1
|
|
27
|
-
fi
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# 已安装 询问是否更新nginx
|
|
31
|
-
if ((has_nginx_installed == 1)); then
|
|
32
|
-
while true; do
|
|
33
|
-
read -r -p "Nginx has been installed, re-install it?[Y/N]" yn
|
|
34
|
-
case $yn in
|
|
35
|
-
[Yy]*)
|
|
36
|
-
chmod +x "$basepath"/../nginx/script/install.sh
|
|
37
|
-
sh "$basepath"/../nginx/script/install.sh "${@}"
|
|
38
|
-
if [[ $? != 0 ]]; then
|
|
39
|
-
echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
|
|
40
|
-
exit 1
|
|
41
|
-
fi
|
|
42
|
-
break
|
|
43
|
-
;;
|
|
44
|
-
[Nn]*) break ;;
|
|
45
|
-
*) echo "Please answer yes or no." ;;
|
|
46
|
-
esac
|
|
47
|
-
done
|
|
48
|
-
fi
|
|
49
|
-
|
|
50
7
|
start
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# nginx
|
|
Binary file
|
|
Binary file
|
|
Binary file
|