@wjwjq/release-helper 0.1.3 → 0.1.5
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/.release/doc//351/203/250/347/275/262/346/211/213/345/206/214.md +15 -23
- package/dist/.release/nginx/nginx.conf +1 -1
- package/dist/deploy/pkg/nginx/nginx.logrotate.tpl +14 -0
- package/dist/deploy/script/common.sh +1 -0
- package/dist/deploy/script/nginx.sh +29 -20
- package/package.json +2 -2
- package/src/.release/doc//351/203/250/347/275/262/346/211/213/345/206/214.md +15 -23
- package/src/.release/nginx/nginx.conf +1 -1
- package/src/deploy/pkg/nginx/nginx.logrotate.tpl +14 -0
- package/src/deploy/script/common.sh +1 -0
- package/src/deploy/script/nginx.sh +29 -20
|
@@ -182,22 +182,31 @@ chmod +x upgrade.sh
|
|
|
182
182
|
| 安装目录 | /opt/$APP_NAME$/ |
|
|
183
183
|
| 版本文件 | /opt/$APP_NAME$/version |
|
|
184
184
|
| nginx配置文件 | /opt/$APP_NAME$/nginx/nginx.conf |
|
|
185
|
-
| 日志文件位置 | /var/log
|
|
185
|
+
| 日志文件位置 | /var/log/$APP_NAME$/nginx.log |
|
|
186
186
|
| 系统静态资源目录 | /opt/$APP_NAME$/assets/ |
|
|
187
187
|
| 系统配置文件 | /opt/$APP_NAME$/assets/settings |
|
|
188
188
|
| system service位置 | /usr/lib/systemd/system/$APP_NAME$.nginx.service |
|
|
189
|
-
|
|
|
190
|
-
| systemctl 启动命令 | systemctl start $APP_NAME$.nginx.service |
|
|
189
|
+
| 日志翻转配置位置 | /etc/logrotate.d/$APP_NAME$.nginx |
|
|
191
190
|
|
|
192
191
|
## 4.2 启动命令
|
|
193
192
|
|
|
194
|
-
|
|
193
|
+
### 4.2.1 原始命令
|
|
195
194
|
|
|
196
195
|
```bash
|
|
197
196
|
/usr/sbin/nginx -c /opt/$APP_NAME$/nginx/nginx.conf
|
|
198
197
|
```
|
|
199
198
|
|
|
200
|
-
|
|
199
|
+
### 4.2.2 supervisor
|
|
200
|
+
|
|
201
|
+
需安装时选择 -standalone 模式
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
supervisorctl start $APP_NAME$.nginx
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 4.2.3 systemctl
|
|
208
|
+
|
|
209
|
+
需安装时选择 -cluster 模式
|
|
201
210
|
|
|
202
211
|
```bash
|
|
203
212
|
systemctl start $APP_NAME$.nginx.service
|
|
@@ -406,21 +415,4 @@ tar: Error is not recoverable: exiting now
|
|
|
406
415
|
|
|
407
416
|
页面配置: **最新版配置文件,请查看最新版本$APP_NAME$.tar.gz解压路径"/$APP_NAME$/pkg/assets/settings"**
|
|
408
417
|
|
|
409
|
-
nginx配置: **最新版配置文件,请查看最新版本$APP_NAME$.tar.gz解压路径"/$APP_NAME$/pkg/nginx/nginx.conf"**
|
|
410
|
-
|
|
411
|
-
## 5.1 v1.7.0
|
|
412
|
-
|
|
413
|
-
无变更, 无需手动修改
|
|
414
|
-
|
|
415
|
-
## 5.2 v1.8.0
|
|
416
|
-
|
|
417
|
-
新增配置项 安全事件返回条数限制
|
|
418
|
-
|
|
419
|
-
```text
|
|
420
|
-
# 第5行
|
|
421
|
-
systemSafeEventDate.limit=43200
|
|
422
|
-
````
|
|
423
|
-
|
|
424
|
-
## 5.3 v1.9.0
|
|
425
|
-
|
|
426
|
-
无变更, 无需手动修改
|
|
418
|
+
nginx配置: **最新版配置文件,请查看最新版本$APP_NAME$.tar.gz解压路径"/$APP_NAME$/pkg/nginx/nginx.conf"**
|
|
@@ -124,7 +124,7 @@ http {
|
|
|
124
124
|
proxy_set_header Host $host;
|
|
125
125
|
proxy_set_header X-Real-IP $remote_addr;
|
|
126
126
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
127
|
-
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
|
|
127
|
+
# proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
|
|
128
128
|
proxy_max_temp_file_size 0;
|
|
129
129
|
proxy_connect_timeout 600;
|
|
130
130
|
proxy_send_timeout 600;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/var/log/__app_name__/*.log {
|
|
2
|
+
daily
|
|
3
|
+
missingok
|
|
4
|
+
minsize 100M
|
|
5
|
+
rotate 3
|
|
6
|
+
compress
|
|
7
|
+
delaycompress
|
|
8
|
+
notifempty
|
|
9
|
+
create 0644 __user__ __usergroup__
|
|
10
|
+
sharedscripts
|
|
11
|
+
postrotate
|
|
12
|
+
[ -f __pid_file__ ] && kill -USR1 `cat __pid_file__`
|
|
13
|
+
endscript
|
|
14
|
+
}
|
|
@@ -14,32 +14,26 @@ nginx_conf_install_path="$prefix/opt/${app_name}/nginx/"
|
|
|
14
14
|
nginx_conf_path="${nginx_conf_install_path}nginx.conf"
|
|
15
15
|
|
|
16
16
|
# asset_path="$prefix/opt/posidon-frontend/"
|
|
17
|
-
|
|
18
|
-
nginx_log_file="
|
|
17
|
+
nginx_info_path="/var/log/${app_name}"
|
|
18
|
+
nginx_log_file="nginx.log"
|
|
19
19
|
#不放在var/run 是因为重启后 var/run/下面的文件及目录会被清除
|
|
20
|
-
|
|
21
|
-
nginx_pid_file_path="$nginx_pid_dir${app_name}.nginx.pid"
|
|
20
|
+
nginx_pid_file_path="$nginx_info_path/nginx.pid"
|
|
22
21
|
|
|
23
22
|
conf_version=$(awk '{print $1}' "${pkg_path}"/version)
|
|
24
23
|
echo "$conf_version"
|
|
25
24
|
|
|
26
25
|
copy_nginx_conf_and_write_verison() {
|
|
27
26
|
mkdir -p "$nginx_conf_install_path"
|
|
28
|
-
# 创建pid
|
|
29
|
-
mkdir -p $
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# 创建日志目录
|
|
34
|
-
mkdir -p $nginx_log_path
|
|
35
|
-
touch $nginx_log_path/$nginx_log_file
|
|
36
|
-
chown -R $user:$usergroup $nginx_log_path
|
|
37
|
-
chmod 744 -R $nginx_log_path
|
|
27
|
+
# 创建pid目录. 创建日志目录
|
|
28
|
+
mkdir -p $nginx_info_path
|
|
29
|
+
touch $nginx_info_path/$nginx_log_file
|
|
30
|
+
chown -R $user:$usergroup $nginx_info_path
|
|
31
|
+
chmod 744 -R $nginx_info_path
|
|
38
32
|
|
|
39
33
|
access_log_super="access_log /dev/stdout main"
|
|
40
34
|
error_log_super="error_log /dev/stderr warn"
|
|
41
|
-
access_log="access_log $
|
|
42
|
-
error_log="error_log $
|
|
35
|
+
access_log="access_log $nginx_info_path/$nginx_log_file main"
|
|
36
|
+
error_log="error_log $nginx_info_path/$nginx_log_file"
|
|
43
37
|
pid_file="pid $nginx_pid_file_path"
|
|
44
38
|
|
|
45
39
|
exec=$(get_exec_path)
|
|
@@ -145,16 +139,16 @@ get_exec_cmd() {
|
|
|
145
139
|
|
|
146
140
|
add_nginx_service() {
|
|
147
141
|
#添加到服务
|
|
148
|
-
exec_cmd="$(get_exec_cmd) -e $
|
|
142
|
+
exec_cmd="$(get_exec_cmd) -e $nginx_info_path/$nginx_log_file"
|
|
149
143
|
cp "$pkg_path"/nginx/nginx.service.tpl ./nginx.service
|
|
150
144
|
|
|
151
|
-
check_cmd="$exec -t -c $nginx_conf_path -e $
|
|
145
|
+
check_cmd="$exec -t -c $nginx_conf_path -e $nginx_info_path/$nginx_log_file"
|
|
152
146
|
version=$(echo "$conf_version" | grep -oP '\d+\.\d+\.\d+')
|
|
153
147
|
|
|
154
148
|
sed -i "s#_user_group_#$usergroup#g" ./nginx.service
|
|
155
149
|
sed -i "s#_user_#$user#g" ./nginx.service
|
|
156
150
|
sed -i "s#_exec_cmd_#$exec_cmd #g" ./nginx.service
|
|
157
|
-
sed -i "s#_log_path_#$
|
|
151
|
+
sed -i "s#_log_path_#$nginx_info_path#g" ./nginx.service
|
|
158
152
|
sed -i "s#_log_file_#$nginx_log_file#g" ./nginx.service
|
|
159
153
|
sed -i "s#_conf_path_#$nginx_conf_path#g" ./nginx.service
|
|
160
154
|
sed -i "s#_version_#$version#g" ./nginx.service
|
|
@@ -171,6 +165,21 @@ add_nginx_service() {
|
|
|
171
165
|
rm -rf /usr/lib/systemd/system/"$app_name".nginx.service
|
|
172
166
|
fi
|
|
173
167
|
}
|
|
168
|
+
|
|
169
|
+
add_log_rotate(){
|
|
170
|
+
mkdir -p /etc/logrotate.d
|
|
171
|
+
|
|
172
|
+
rm -rf /etc/logrotate.d/${app_name}.nginx
|
|
173
|
+
#添加日志翻转
|
|
174
|
+
cp "$pkg_path"/nginx/nginx.logrotate.tpl ./nginx.logrotate
|
|
175
|
+
|
|
176
|
+
sed -i "s#__usergroup__#$usergroup#g" ./nginx.logrotate
|
|
177
|
+
sed -i "s#__user__#$user#g" ./nginx.logrotate
|
|
178
|
+
sed -i "s#__app_name__#$app_name#g" ./nginx.logrotate
|
|
179
|
+
sed -i "s#__pid_file__#$nginx_pid_file_path#g" ./nginx.logrotate
|
|
180
|
+
|
|
181
|
+
cp -f ./nginx.logrotate /etc/logrotate.d/${app_name}.nginx
|
|
182
|
+
}
|
|
174
183
|
#------------------------------------ nginx服务配置文件服务 end----------------------------------
|
|
175
184
|
|
|
176
185
|
|
|
@@ -247,7 +256,7 @@ install_nginx_binary() {
|
|
|
247
256
|
log_error "nginx installation failed!"
|
|
248
257
|
fi
|
|
249
258
|
|
|
250
|
-
|
|
259
|
+
ln -sf "$nginx_binary_install_path"sbin/nginx /usr/sbin/nginx
|
|
251
260
|
|
|
252
261
|
# 修改/etc/nginx 用户(组)
|
|
253
262
|
chown -R $user:$usergroup "$nginx_binary_install_path"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wjwjq/release-helper",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "generate deployment package for frontend, include nginx...",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"node": "^18.20.0 || >=20.0.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
|
-
"localpack": "pnpm link --global",
|
|
66
|
+
"localpack": "pnpm build && pnpm link --global",
|
|
67
67
|
"postinstall": "node dist/start_prepare.js",
|
|
68
68
|
"build": "rm -rf dist && rollup -c",
|
|
69
69
|
"prepublish": "pnpm build"
|
|
@@ -182,22 +182,31 @@ chmod +x upgrade.sh
|
|
|
182
182
|
| 安装目录 | /opt/$APP_NAME$/ |
|
|
183
183
|
| 版本文件 | /opt/$APP_NAME$/version |
|
|
184
184
|
| nginx配置文件 | /opt/$APP_NAME$/nginx/nginx.conf |
|
|
185
|
-
| 日志文件位置 | /var/log
|
|
185
|
+
| 日志文件位置 | /var/log/$APP_NAME$/nginx.log |
|
|
186
186
|
| 系统静态资源目录 | /opt/$APP_NAME$/assets/ |
|
|
187
187
|
| 系统配置文件 | /opt/$APP_NAME$/assets/settings |
|
|
188
188
|
| system service位置 | /usr/lib/systemd/system/$APP_NAME$.nginx.service |
|
|
189
|
-
|
|
|
190
|
-
| systemctl 启动命令 | systemctl start $APP_NAME$.nginx.service |
|
|
189
|
+
| 日志翻转配置位置 | /etc/logrotate.d/$APP_NAME$.nginx |
|
|
191
190
|
|
|
192
191
|
## 4.2 启动命令
|
|
193
192
|
|
|
194
|
-
|
|
193
|
+
### 4.2.1 原始命令
|
|
195
194
|
|
|
196
195
|
```bash
|
|
197
196
|
/usr/sbin/nginx -c /opt/$APP_NAME$/nginx/nginx.conf
|
|
198
197
|
```
|
|
199
198
|
|
|
200
|
-
|
|
199
|
+
### 4.2.2 supervisor
|
|
200
|
+
|
|
201
|
+
需安装时选择 -standalone 模式
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
supervisorctl start $APP_NAME$.nginx
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 4.2.3 systemctl
|
|
208
|
+
|
|
209
|
+
需安装时选择 -cluster 模式
|
|
201
210
|
|
|
202
211
|
```bash
|
|
203
212
|
systemctl start $APP_NAME$.nginx.service
|
|
@@ -406,21 +415,4 @@ tar: Error is not recoverable: exiting now
|
|
|
406
415
|
|
|
407
416
|
页面配置: **最新版配置文件,请查看最新版本$APP_NAME$.tar.gz解压路径"/$APP_NAME$/pkg/assets/settings"**
|
|
408
417
|
|
|
409
|
-
nginx配置: **最新版配置文件,请查看最新版本$APP_NAME$.tar.gz解压路径"/$APP_NAME$/pkg/nginx/nginx.conf"**
|
|
410
|
-
|
|
411
|
-
## 5.1 v1.7.0
|
|
412
|
-
|
|
413
|
-
无变更, 无需手动修改
|
|
414
|
-
|
|
415
|
-
## 5.2 v1.8.0
|
|
416
|
-
|
|
417
|
-
新增配置项 安全事件返回条数限制
|
|
418
|
-
|
|
419
|
-
```text
|
|
420
|
-
# 第5行
|
|
421
|
-
systemSafeEventDate.limit=43200
|
|
422
|
-
````
|
|
423
|
-
|
|
424
|
-
## 5.3 v1.9.0
|
|
425
|
-
|
|
426
|
-
无变更, 无需手动修改
|
|
418
|
+
nginx配置: **最新版配置文件,请查看最新版本$APP_NAME$.tar.gz解压路径"/$APP_NAME$/pkg/nginx/nginx.conf"**
|
|
@@ -124,7 +124,7 @@ http {
|
|
|
124
124
|
proxy_set_header Host $host;
|
|
125
125
|
proxy_set_header X-Real-IP $remote_addr;
|
|
126
126
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
127
|
-
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
|
|
127
|
+
# proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
|
|
128
128
|
proxy_max_temp_file_size 0;
|
|
129
129
|
proxy_connect_timeout 600;
|
|
130
130
|
proxy_send_timeout 600;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/var/log/__app_name__/*.log {
|
|
2
|
+
daily
|
|
3
|
+
missingok
|
|
4
|
+
minsize 100M
|
|
5
|
+
rotate 3
|
|
6
|
+
compress
|
|
7
|
+
delaycompress
|
|
8
|
+
notifempty
|
|
9
|
+
create 0644 __user__ __usergroup__
|
|
10
|
+
sharedscripts
|
|
11
|
+
postrotate
|
|
12
|
+
[ -f __pid_file__ ] && kill -USR1 `cat __pid_file__`
|
|
13
|
+
endscript
|
|
14
|
+
}
|
|
@@ -14,32 +14,26 @@ nginx_conf_install_path="$prefix/opt/${app_name}/nginx/"
|
|
|
14
14
|
nginx_conf_path="${nginx_conf_install_path}nginx.conf"
|
|
15
15
|
|
|
16
16
|
# asset_path="$prefix/opt/posidon-frontend/"
|
|
17
|
-
|
|
18
|
-
nginx_log_file="
|
|
17
|
+
nginx_info_path="/var/log/${app_name}"
|
|
18
|
+
nginx_log_file="nginx.log"
|
|
19
19
|
#不放在var/run 是因为重启后 var/run/下面的文件及目录会被清除
|
|
20
|
-
|
|
21
|
-
nginx_pid_file_path="$nginx_pid_dir${app_name}.nginx.pid"
|
|
20
|
+
nginx_pid_file_path="$nginx_info_path/nginx.pid"
|
|
22
21
|
|
|
23
22
|
conf_version=$(awk '{print $1}' "${pkg_path}"/version)
|
|
24
23
|
echo "$conf_version"
|
|
25
24
|
|
|
26
25
|
copy_nginx_conf_and_write_verison() {
|
|
27
26
|
mkdir -p "$nginx_conf_install_path"
|
|
28
|
-
# 创建pid
|
|
29
|
-
mkdir -p $
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# 创建日志目录
|
|
34
|
-
mkdir -p $nginx_log_path
|
|
35
|
-
touch $nginx_log_path/$nginx_log_file
|
|
36
|
-
chown -R $user:$usergroup $nginx_log_path
|
|
37
|
-
chmod 744 -R $nginx_log_path
|
|
27
|
+
# 创建pid目录. 创建日志目录
|
|
28
|
+
mkdir -p $nginx_info_path
|
|
29
|
+
touch $nginx_info_path/$nginx_log_file
|
|
30
|
+
chown -R $user:$usergroup $nginx_info_path
|
|
31
|
+
chmod 744 -R $nginx_info_path
|
|
38
32
|
|
|
39
33
|
access_log_super="access_log /dev/stdout main"
|
|
40
34
|
error_log_super="error_log /dev/stderr warn"
|
|
41
|
-
access_log="access_log $
|
|
42
|
-
error_log="error_log $
|
|
35
|
+
access_log="access_log $nginx_info_path/$nginx_log_file main"
|
|
36
|
+
error_log="error_log $nginx_info_path/$nginx_log_file"
|
|
43
37
|
pid_file="pid $nginx_pid_file_path"
|
|
44
38
|
|
|
45
39
|
exec=$(get_exec_path)
|
|
@@ -145,16 +139,16 @@ get_exec_cmd() {
|
|
|
145
139
|
|
|
146
140
|
add_nginx_service() {
|
|
147
141
|
#添加到服务
|
|
148
|
-
exec_cmd="$(get_exec_cmd) -e $
|
|
142
|
+
exec_cmd="$(get_exec_cmd) -e $nginx_info_path/$nginx_log_file"
|
|
149
143
|
cp "$pkg_path"/nginx/nginx.service.tpl ./nginx.service
|
|
150
144
|
|
|
151
|
-
check_cmd="$exec -t -c $nginx_conf_path -e $
|
|
145
|
+
check_cmd="$exec -t -c $nginx_conf_path -e $nginx_info_path/$nginx_log_file"
|
|
152
146
|
version=$(echo "$conf_version" | grep -oP '\d+\.\d+\.\d+')
|
|
153
147
|
|
|
154
148
|
sed -i "s#_user_group_#$usergroup#g" ./nginx.service
|
|
155
149
|
sed -i "s#_user_#$user#g" ./nginx.service
|
|
156
150
|
sed -i "s#_exec_cmd_#$exec_cmd #g" ./nginx.service
|
|
157
|
-
sed -i "s#_log_path_#$
|
|
151
|
+
sed -i "s#_log_path_#$nginx_info_path#g" ./nginx.service
|
|
158
152
|
sed -i "s#_log_file_#$nginx_log_file#g" ./nginx.service
|
|
159
153
|
sed -i "s#_conf_path_#$nginx_conf_path#g" ./nginx.service
|
|
160
154
|
sed -i "s#_version_#$version#g" ./nginx.service
|
|
@@ -171,6 +165,21 @@ add_nginx_service() {
|
|
|
171
165
|
rm -rf /usr/lib/systemd/system/"$app_name".nginx.service
|
|
172
166
|
fi
|
|
173
167
|
}
|
|
168
|
+
|
|
169
|
+
add_log_rotate(){
|
|
170
|
+
mkdir -p /etc/logrotate.d
|
|
171
|
+
|
|
172
|
+
rm -rf /etc/logrotate.d/${app_name}.nginx
|
|
173
|
+
#添加日志翻转
|
|
174
|
+
cp "$pkg_path"/nginx/nginx.logrotate.tpl ./nginx.logrotate
|
|
175
|
+
|
|
176
|
+
sed -i "s#__usergroup__#$usergroup#g" ./nginx.logrotate
|
|
177
|
+
sed -i "s#__user__#$user#g" ./nginx.logrotate
|
|
178
|
+
sed -i "s#__app_name__#$app_name#g" ./nginx.logrotate
|
|
179
|
+
sed -i "s#__pid_file__#$nginx_pid_file_path#g" ./nginx.logrotate
|
|
180
|
+
|
|
181
|
+
cp -f ./nginx.logrotate /etc/logrotate.d/${app_name}.nginx
|
|
182
|
+
}
|
|
174
183
|
#------------------------------------ nginx服务配置文件服务 end----------------------------------
|
|
175
184
|
|
|
176
185
|
|
|
@@ -247,7 +256,7 @@ install_nginx_binary() {
|
|
|
247
256
|
log_error "nginx installation failed!"
|
|
248
257
|
fi
|
|
249
258
|
|
|
250
|
-
|
|
259
|
+
ln -sf "$nginx_binary_install_path"sbin/nginx /usr/sbin/nginx
|
|
251
260
|
|
|
252
261
|
# 修改/etc/nginx 用户(组)
|
|
253
262
|
chown -R $user:$usergroup "$nginx_binary_install_path"
|