@wjwjq/release-helper 0.1.5 → 0.1.6

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.
Files changed (42) hide show
  1. package/dist/.release/release.conf.yaml +2 -0
  2. package/dist/cli.js +1 -1
  3. package/dist/deploy/script/common.sh +36 -29
  4. package/dist/deploy/script/prompt.sh +6 -0
  5. package/dist/pack.js +2 -1
  6. package/dist/prepare.js +14 -4
  7. package/dist/start_prepare.js +1 -1
  8. package/package.json +1 -1
  9. package/src/.release/README.md +0 -73
  10. package/src/.release/doc//351/203/250/347/275/262/346/211/213/345/206/214.md +0 -418
  11. package/src/.release/nginx/ca/ca.crt +0 -32
  12. package/src/.release/nginx/ca/ca.key +0 -54
  13. package/src/.release/nginx/ca/client.crt +0 -100
  14. package/src/.release/nginx/ca/client.csr +0 -16
  15. package/src/.release/nginx/ca/client.p12 +0 -0
  16. package/src/.release/nginx/ca/client.pem +0 -30
  17. package/src/.release/nginx/ca/server.crt +0 -101
  18. package/src/.release/nginx/ca/server.csr +0 -17
  19. package/src/.release/nginx/ca/server.key +0 -27
  20. package/src/.release/nginx/ca/server.pem +0 -30
  21. package/src/.release/nginx/nginx.conf +0 -179
  22. package/src/.release/release.conf.yaml +0 -15
  23. package/src/cli.ts +0 -99
  24. package/src/deploy/pkg/nginx/nginx.logrotate.tpl +0 -14
  25. package/src/deploy/pkg/nginx/nginx.service.tpl +0 -32
  26. package/src/deploy/pkg/nginx_binary/compile.sh +0 -39
  27. package/src/deploy/pkg/nginx_binary/nginx-arm-ssl1.1.1.tar.gz +0 -0
  28. package/src/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.0.2.tar.gz +0 -0
  29. package/src/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.1.1.tar.gz +0 -0
  30. package/src/deploy/pkg/nginx_binary/nginx-x86_64-ssl3.0.7.tar.gz +0 -0
  31. package/src/deploy/script/common.sh +0 -196
  32. package/src/deploy/script/install.sh +0 -7
  33. package/src/deploy/script/nginx.sh +0 -265
  34. package/src/deploy/script/prompt.sh +0 -110
  35. package/src/deploy/script/readme.md +0 -10
  36. package/src/deploy/script/upgrade.sh +0 -7
  37. package/src/logger.ts +0 -18
  38. package/src/pack.ts +0 -152
  39. package/src/prepare.ts +0 -120
  40. package/src/publish.ts +0 -308
  41. package/src/release.ts +0 -292
  42. package/src/start_prepare.ts +0 -13
@@ -10,6 +10,8 @@ assetsDir: 'dist'
10
10
  # nginx和assets 所属用户和用户组
11
11
  user: root
12
12
  userGroup: root
13
+ # 安装目录
14
+ installDir: /opt
13
15
 
14
16
  # 指定安装模式 standalone(supervisor) 、 cluster(agent\systemd) 、 both
15
17
  installMode: both
package/dist/cli.js CHANGED
@@ -16,7 +16,7 @@ cli.command("init", "generate release configuration").action(async (options) =>
16
16
  try {
17
17
  logger.info("start to generate .release configuration ");
18
18
  const { prepare } = await import('./prepare.js');
19
- await prepare();
19
+ await prepare({ callBy: "init" });
20
20
  logger.info("done");
21
21
  } catch (e) {
22
22
  console.error(`release-helper error: `, e);
@@ -133,34 +133,37 @@ install_assets() {
133
133
  }
134
134
 
135
135
  start() {
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
136
+ # 仅静态文件
137
+ if [[ "${mode}" != 3 ]]; then
138
+ # 未安装
139
+ if ((has_nginx_installed == 0)); then
140
+ install_nginx_binary
141
+
142
+ if [[ $? != 0 ]]; then
143
+ echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
144
+ exit 1
145
+ fi
143
146
  fi
144
- fi
145
147
 
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
148
+ # 已安装 询问是否更新nginx
149
+ if ((has_nginx_installed == 1)); then
150
+ while true; do
151
+ read -r -p "Nginx has been installed, re-install it?[Y/N]" yn
152
+ case $yn in
153
+ [Yy]*)
154
+ install_nginx_binary
155
+
156
+ if [[ $? != 0 ]]; then
157
+ echo "$(tput setaf 1)"failed to install!"$(tput sgr0)"
158
+ exit 1
159
+ fi
160
+ break
161
+ ;;
162
+ [Nn]*) break ;;
163
+ *) echo "Please answer yes or no." ;;
164
+ esac
165
+ done
166
+ fi
164
167
  fi
165
168
 
166
169
  # 创建用户
@@ -179,9 +182,13 @@ start() {
179
182
 
180
183
  mkdir -p "$install_path"
181
184
 
182
- copy_nginx_conf_and_write_verison
183
- add_nginx_service
184
- add_log_rotate
185
+ # 仅静态文件
186
+ if [[ "${mode}" != 3 ]]; then
187
+ copy_nginx_conf_and_write_verison
188
+ add_nginx_service
189
+ add_log_rotate
190
+ fi
191
+
185
192
  install_assets
186
193
 
187
194
  # 修改所属用户
@@ -12,6 +12,8 @@ if [[ "${mode}" == "standalone" ]]; then
12
12
  mode=1
13
13
  elif [[ "${mode}" == "cluster" ]]; then
14
14
  mode=2
15
+ elif [[ "${mode}" == "static" ]]; then
16
+ mode=3
15
17
  else
16
18
  mode=''
17
19
  fi
@@ -28,6 +30,10 @@ while [ $# -gt 0 ]; do
28
30
  mode=2
29
31
  shift
30
32
  ;;
33
+ -SS | -static)
34
+ mode=3
35
+ shift
36
+ ;;
31
37
  -h | --help)
32
38
  echo "supported parameters: "
33
39
  echo "-S, -standalone install for supervisord startup mode, conflict with -C"
package/dist/pack.js CHANGED
@@ -40,7 +40,8 @@ async function pack(version) {
40
40
  fs.writeFileSync(path.resolve(assetsDir, "version"), version, { encoding: "utf-8" });
41
41
  fs.writeFileSync(path.resolve(nginxDir, "version"), version, { encoding: "utf-8" });
42
42
  logger.info(pc.green(`version: ${version} added`));
43
- const assetInstallPath = `/opt/${projectName}/`;
43
+ const installDir = releaseConf.installDir.endsWith("/") ? releaseConf.installDir.replace(/\/$/, "") : releaseConf.installDir;
44
+ const assetInstallPath = `${installDir}/${projectName}/`;
44
45
  logger.info(pc.green(`start to replace variants in common.sh`));
45
46
  replaceFileContent({
46
47
  filePath: path.resolve(projectDir, "script", "common.sh"),
package/dist/prepare.js CHANGED
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
7
7
  import { logger } from './logger.js';
8
8
  import 'picocolors';
9
9
 
10
- const installMode = ["standalone", "cluster", "both"];
10
+ const installMode = ["standalone", "cluster", "static", "all"];
11
11
  const __work_dir = process.env.INIT_CWD || process.cwd();
12
12
  const __releaseDir = path.resolve(__work_dir, ".release");
13
13
  const __filename = fileURLToPath(import.meta.url);
@@ -22,6 +22,11 @@ function parseConf(file) {
22
22
  return {};
23
23
  }
24
24
  }
25
+ function isValidLinuxPath(path2) {
26
+ const absolutePathPattern = /^\//;
27
+ const relativePathPattern = /^(\.\/|\.\.\/)/;
28
+ return absolutePathPattern.test(path2) || relativePathPattern.test(path2);
29
+ }
25
30
  const releaseConf = Object.assign({
26
31
  host: "",
27
32
  token: "",
@@ -31,10 +36,11 @@ const releaseConf = Object.assign({
31
36
  assetsDir: "dist",
32
37
  user: "root",
33
38
  userGroup: "root",
34
- installMode: "both"
39
+ installMode: "both",
40
+ installDir: "/opt"
35
41
  }, parseConf(__releaseConfPath));
36
42
  const $ = execa({ encoding: "utf8" });
37
- async function prepare() {
43
+ async function prepare({ callBy } = { callBy: "postinstall" }) {
38
44
  const copyFiles = () => {
39
45
  fs.cpSync(path.resolve(__dirname, ".release"), __releaseDir, { recursive: true });
40
46
  };
@@ -43,7 +49,7 @@ async function prepare() {
43
49
  copyFiles();
44
50
  logger.tip(`\u8BF7\u6CE8\u610F\u4FEE\u6539.release/${releaseConfFileName} \u914D\u7F6E\u4FE1\u606F`);
45
51
  } else {
46
- if (!process.env.INIT_CWD) {
52
+ if (callBy === "init") {
47
53
  const shouldRegenerate = await inquirer.confirm(
48
54
  {
49
55
  message: ".release\u914D\u7F6E\u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u91CD\u65B0\u751F\u6210\uFF1F"
@@ -78,6 +84,10 @@ async function checkEnvInfo() {
78
84
  logger.error(`The field: [${field}]'s value should be one of ${installMode.join(" | ")}`);
79
85
  process.exit(1);
80
86
  }
87
+ if (field === "installDir" && !isValidLinuxPath(value)) {
88
+ logger.error(`The field: [${field}]'s value is not a legal path`);
89
+ process.exit(1);
90
+ }
81
91
  }
82
92
  }
83
93
 
@@ -11,7 +11,7 @@ import 'node:url';
11
11
  (async function startPrepare() {
12
12
  try {
13
13
  logger.info("start to generate .release configuration ");
14
- await prepare();
14
+ await prepare({ callBy: "postinstall" });
15
15
  logger.info("done");
16
16
  } catch (error) {
17
17
  console.error(`release-helper error: `, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjwjq/release-helper",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "generate deployment package for frontend, include nginx...",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,73 +0,0 @@
1
- # release-helper
2
-
3
- 打包 和发布辅助工具, 集成nginx二进制文件,支持supervisor和systemctl启动安装模式
4
-
5
- 服务器端安装和更新,请看发布后文档
6
-
7
- ## 使用
8
-
9
- ### 推荐
10
-
11
- 在package.json中添加如下命令, 后续通过pnpm pak/pub/publish使用
12
-
13
- ```bash
14
- "pak": "release-helper pack",
15
- "pub": "release-helper publish",
16
- "release": "release-helper release",
17
- ```
18
-
19
- ### 单独使用命令
20
-
21
- 请在项目根目录,使用命令
22
-
23
- #### 初始化
24
-
25
- 常规来讲,通过pnpm安装时,会自动在项目根目录位置,生成.release目录,若未生成,请手动生成
26
-
27
- ```bash
28
- release-helper init
29
- ```
30
-
31
- #### 打包
32
-
33
- 仅打包成xx.tar.gz 需指定release.conf.yaml中assetsDir字段
34
-
35
- ```bash
36
- release-helper pack
37
- ```
38
-
39
- #### 发版
40
-
41
- 发布git release相关版本; 需指定release.conf.yaml中host等相关字段
42
-
43
- ```bash
44
- release-helper release
45
- ```
46
-
47
- ## .release 目录说明
48
-
49
- ### doc 目录
50
-
51
- 用于release时附带的文档,文档中可以使用指定变量占位,后续执行release-helper release时会自动遍历,并替换所有变量
52
-
53
- 可使用变量及说明:
54
-
55
- | **占位符** | **含义** |
56
- | ------------- | ---------------------------------------------------- |
57
- | \$APP\_NAME\$ | 应用名称(自动读取package.json中name字段值) |
58
- | \$VERSION\$ | 用户指定的版本号 |
59
- | \$PKG_NAME\$ | tar.gz包名称(值为\$APP_NAME\$\_\$VERSION\$.tar.gz) |
60
-
61
- ### nginx 目录
62
-
63
- 用于存放服务器端nginx的启动配置文件等,部分占位说明及占位符请勿删除,会在服务器端安装或更新时,由脚本自动替换
64
-
65
- 文件说明:
66
- | **文件或目录** | **说明** |
67
- | -------------- | --------------------------------------------------------- |
68
- | ca | nginx https使用到的证书,变更时需对应修改nginx.conf中的值 |
69
- | nginx.conf | nginx启动时 需要的配置文件 |
70
-
71
- ### release.conf.yaml
72
-
73
- 打包发布相关配置项
@@ -1,418 +0,0 @@
1
- # 1.基础信息
2
-
3
- version: $VERSION$
4
-
5
- author: release-helper
6
-
7
- # 2. 安装
8
-
9
- ## 2.1 自动安装
10
-
11
- ### 2.1.1 前置条件
12
-
13
- . 从gitlab仓库中$APP_NAME$中获取最新的版本$TAR_PKG$
14
-
15
- ### 2.1.2 安装步骤
16
-
17
- + 步骤一:上传$TAR_PKG$ 到 远程服务器/home 目录下
18
-
19
- + 步骤二:进入/home目录,使用一下命令解压$TAR_PKG$
20
-
21
- ```bash
22
- cd /home; tar -zxvf $TAR_PKG$
23
- ```
24
-
25
- ```text
26
- [root@localhost ~]# cd /home; tar -zxvf $TAR_PKG$
27
- $APP_NAME$/
28
- $APP_NAME$/conf/
29
- $APP_NAME$/conf/nginx.conf
30
- $APP_NAME$/pkg/
31
- ...
32
- $APP_NAME$/script/docker.sh
33
- $APP_NAME$/script/install.sh
34
- $APP_NAME$/script/upgrade.sh
35
- ```
36
-
37
- + 步骤三: 进入/home/$APP_NAME$/script目录下
38
-
39
- ```bash
40
- cd /home/$APP_NAME$/script
41
- ```
42
-
43
- + 步骤四: 给install.sh附加可执行权限
44
-
45
- ```bash
46
- chmod +x install.sh
47
- ```
48
-
49
- + 步骤五: 执行install.sh脚本进行安装
50
-
51
- 以**集群**(agent)模式安装
52
-
53
- ```bash
54
- ./install.sh -cluster
55
- ```
56
-
57
- 以**独立**(supervisor)模式安装
58
-
59
- ```bash
60
- ./install.sh -standalone
61
- ```
62
-
63
- ```text
64
- [root@localhost home]# cd /home/$APP_NAME$/script
65
- [root@localhost script]# chmod +x install.sh
66
- [root@localhost script]# ./install.sh # 不带参数,会报错
67
- 2024-06-28 14:49:40: -----------execute $APP_NAME$ script-------------
68
- 2024-06-28 14:49:40: -----------receive parameter: ------------
69
- 2024-06-28 14:49:40: Fatal error: parameter -standalone or -cluster is required!
70
- [root@localhost script]# ./install.sh -cluster # 携带参数
71
- install_path: /opt/$APP_NAME$/
72
- $VERSION$
73
- Nginx has been installed, re-install it?[Y/N]n # 若检测nginx可执行文件已安装, 会询问是否需要重新安装NGINX,通常输入n 即可
74
- 2024-06-28 14:57:23: -----------execute $APP_NAME$ script-------------
75
- 2024-06-28 14:57:23: -----------receive parameter: -cluster------------
76
- 2024-06-28 14:57:23: -------------------------------------------------
77
- 2024-06-28 14:57:23: -------start to install Cluster mode-------
78
- 2024-06-28 14:57:23: -------------------------------------------------
79
- ...
80
- 2024-06-28 14:57:39: -----------execute $APP_NAME$ script-------------
81
- ...
82
- 2024-06-28 14:57:39: nginx start command: /usr/sbin/nginx -c /opt/$APP_NAME$/nginx/nginx.conf
83
- 2024-06-28 14:57:39: $VERSION$ /opt/$APP_NAME$/nginx/nginx.conf replaced successfully!
84
- 2024-06-28 14:57:39: add $APP_NAME$.nginx.service to /usr/lib/systemd/system/
85
- 2024-06-28 14:57:39: /opt/$APP_NAME$/assets/settings
86
- 2024-06-28 14:57:39: $APP_NAME$ deployed successfully #安装成功
87
- ```
88
-
89
- ### 2.1.3 启动
90
-
91
- 所有组件安装后统一通过supervisor或agent组件启动, 详见supervisor或agent部署文档
92
-
93
- ### 2.2 手动安装
94
-
95
- 暂无
96
-
97
- # 3. 升级
98
-
99
- ## 3.1 自动升级
100
-
101
- ### 3.1.1 前置条件
102
-
103
- 1. 已安装$APP_NAME$
104
-
105
- 2. 从gitlab仓库中$APP_NAME$-new中获取最新的版本$TAR_PKG$
106
-
107
- ### 3.1.2 升级步骤
108
-
109
- + 步骤一:上传$TAR_PKG$ 到 远程服务器/home 目录下
110
-
111
- + 步骤二:进入/home目录,使用一下命令解压$TAR_PKG$
112
-
113
- ```bash
114
- cd /home; tar -zxvf $TAR_PKG$
115
- ```
116
-
117
- ```text
118
- [root@localhost ~]# cd /home; tar -zxvf $TAR_PKG$
119
- $APP_NAME$/
120
- $APP_NAME$/conf/
121
- $APP_NAME$/conf/nginx.conf
122
- $APP_NAME$/pkg/
123
- ...
124
- $APP_NAME$/script/docker.sh
125
- $APP_NAME$/script/install.sh
126
- $APP_NAME$/script/upgrade.sh
127
- ```
128
-
129
- + 步骤三: 进入/home/$APP_NAME$/script目录下
130
-
131
- ```bash
132
- cd /home/$APP_NAME$/script
133
- ```
134
-
135
- + 步骤四: 给upgrade.sh附加可执行权限
136
-
137
- ```bash
138
- chmod +x upgrade.sh
139
- ```
140
-
141
- + 步骤五: 执行upgrade.sh脚本进行安装
142
-
143
- ```bash
144
- ./upgrade.sh
145
- ```
146
-
147
- ```text
148
- [root@localhost home]# cd /home/$APP_NAME$/script
149
- [root@localhost script]# chmod +x upgrade.sh
150
- [root@localhost script]# ./upgrade.sh # 不带参数,会报错
151
- 2024-06-28 14:49:40: -----------execute $APP_NAME$ script-------------
152
- 2024-06-28 14:49:40: -----------receive parameter: ------------
153
- 2024-06-28 14:49:40: Fatal error: parameter -standalone or -cluster is required!
154
- [root@localhost script]# ./upgrade.sh -cluster # 携带参数
155
- 2024-06-28 14:57:23: -----------execute $APP_NAME$ script-------------
156
- 2024-06-28 14:57:23: -----------receive parameter: -cluster------------
157
- 2024-06-28 14:57:23: -------------------------------------------------
158
- 2024-06-28 14:57:23: -------start to upgrade Cluster mode-------
159
- 2024-06-28 14:57:23: -------------------------------------------------
160
- ...
161
- 2024-06-28 14:57:39: -----------execute $APP_NAME$ script-------------
162
- ...
163
- 2024-06-28 14:57:39: nginx start command: /usr/sbin/nginx -c /opt/$APP_NAME$/nginx/nginx.conf
164
- 2024-06-28 14:57:39: $VERSION$ /opt/$APP_NAME$/nginx/nginx.conf replaced successfully!
165
- 2024-06-28 14:57:39: add $APP_NAME$.nginx.service to /usr/lib/systemd/system/
166
- 2024-06-28 14:57:39: /opt/$APP_NAME$/assets/settings
167
- 2024-06-28 14:57:39: $APP_NAME$ deployed successfully #安装成功
168
- ```
169
-
170
- ### 3.1.3 启动
171
-
172
- ## 3.2 手动升级
173
-
174
- 暂无
175
-
176
- # 4. FAQ
177
-
178
- ## 4.1 相关文件位置?
179
-
180
- | **说明** | **路径** |
181
- | ------------------ | ---------------------------------------------------- |
182
- | 安装目录 | /opt/$APP_NAME$/ |
183
- | 版本文件 | /opt/$APP_NAME$/version |
184
- | nginx配置文件 | /opt/$APP_NAME$/nginx/nginx.conf |
185
- | 日志文件位置 | /var/log/$APP_NAME$/nginx.log |
186
- | 系统静态资源目录 | /opt/$APP_NAME$/assets/ |
187
- | 系统配置文件 | /opt/$APP_NAME$/assets/settings |
188
- | system service位置 | /usr/lib/systemd/system/$APP_NAME$.nginx.service |
189
- | 日志翻转配置位置 | /etc/logrotate.d/$APP_NAME$.nginx |
190
-
191
- ## 4.2 启动命令
192
-
193
- ### 4.2.1 原始命令
194
-
195
- ```bash
196
- /usr/sbin/nginx -c /opt/$APP_NAME$/nginx/nginx.conf
197
- ```
198
-
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 模式
210
-
211
- ```bash
212
- systemctl start $APP_NAME$.nginx.service
213
- ```
214
-
215
- ## 4.3 验证
216
-
217
- 正常启动后,使用如下命令,返回如图结果则表示成功 其中5443是nginx.conf 中配置的服务端口
218
-
219
- ```bash
220
- curl https://127.0.0.1:5443 --insecure | grep 'x-v'
221
- ```
222
-
223
- ```text
224
- [root@localhost script]# curl https://127.0.0.1:5443 --insecure | grep 'x-v'
225
- % Total % Received % Xferd Average Speed Time Time Time Current
226
- Dload Upload Total Spent Left Speed
227
- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
228
- <!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta x-v=$VERSION$><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><style>.notice-browser * {
229
- 100 51143 100 51143 0 0 483k 0 --:--:-- --:--:-- --:--:-- 484k
230
- ```
231
-
232
- ## 4.4 版本查看
233
-
234
- ```bash
235
- cat /opt/$APP_NAME$/version
236
- ```
237
-
238
- ```tet
239
- [root@localhost script]# cat /opt/$APP_NAME$/version
240
- $VERSION$
241
- ```
242
-
243
- ## 4.5 修改系统名称
244
-
245
- ```bash
246
- vim /opt/$APP_NAME$/assets/settings
247
- ```
248
-
249
- ```text
250
- #请勿调整顺序,注释单开一行,并用#开头
251
-
252
- systemName.zh="数据安全综合管理系统"
253
- systemName.en="Comprehensive Data Security Platform"
254
- ```
255
-
256
- ## 4.6 修改安全事件查询页面过滤条件时间段的时间限制范围(以分钟为单位,设置时间应不低于10080,即7天,默认设置43200,即30天)
257
-
258
- ```bash
259
- vim /opt/$APP_NAME$/settings
260
- ```
261
-
262
- ```text
263
- #请勿调整顺序,注释单开一行,并用#开头
264
-
265
- systemSafeEventDate.limit=43200
266
- ```
267
-
268
- ## 4.7 Nginx启动失败,提示80端口绑定失败?
269
-
270
- + 问题截图:
271
-
272
- ```text
273
- 2021/12/15 22:16:52 [emerg] 13825#13825: bind() to 0.0.0.0:80 failed (98:Address already in use)
274
- nginx:[emerg] bind() to 0.0.0.0:80 failed (98:Address already in use)
275
- 2021/12/15 22:16:52 [emerg] 13825#13825: bind() to 0.0.0.0:80 failed (98:Address already in use)
276
- nginx:[emerg] bind() to 0.0.0.0:80 failed (98:Address already in use)
277
- 2021/12/15 22:16:52 [emerg] 13825#13825: bind() to 0.0.0.0:80 failed (98:Address already in use)
278
- nginx:[emerg] bind() to 0.0.0.0:80 failed (98:Address already in use)
279
- 2021/12/15 22:16:52 [emerg] 13825#13825: bind() to 0.0.0.0:80 failed (98:Address already in use)
280
- nginx:[emerg] bind() to 0.0.0.0:80 failed (98:Address already in use)
281
- ```
282
-
283
- + 问题说明
284
-
285
- 80端口被占用导致,此问题出现几率,几乎为0
286
-
287
- + 解决方法:
288
-
289
- **先和用户确认是否可以操作**
290
-
291
- 使用如下命令查看占用80的应用,并使用kill杀掉与之相关的进程
292
-
293
- ```bash
294
- netstat -tunlp | grep 80
295
-
296
- **kill** -9 pid
297
- ```
298
-
299
- ## 4.8 更改默认80端口?
300
-
301
- + 修改nginx.conf中server listen;参照下图,注最新配置默认端口为5443
302
-
303
- ```bash
304
- vi /opt/$APP_NAME$/nginx/nginx.conf
305
- ```
306
-
307
- ```text
308
- upstream tomcatposidon{
309
- server localhost:9998; #tomcat
310
- }
311
-
312
- # 开启自定义错误信息响应
313
- fastcgi_intercept_errors on;
314
-
315
-
316
- limit_conn_zone $binary_remote_addr zone=conn:10m; # 限制连接数
317
- limit_req_zone $binary_remote_addr zone=allips:10m rate=500r/s; # 限制请求数
318
-
319
- #server {
320
- #listen 80 default_server;
321
- #listen [::]:80 default_server;
322
- #server_name _;
323
- #return 301 https://$host$request_uri;
324
- #}
325
-
326
- server {
327
- # listen 80;
328
- listen 5443 default_server ssl http2; # 修改此处
329
- server_name localhost;
330
- root /opt/posidon-frontend/;
331
-
332
- error_page 497 =301 https://$host:$server_port$request_uri;
333
-
334
- ssl_certificate ca/server.crt; # 这里为服务器上server.crt的路径
335
- ssl_certificate_key ca/server.key; # 这里为服务器上server.key的路径
336
- #ssl_client_certificate ca/ca.crt; # 双向认证
337
- #ssl_verify_client on; # 双向认证
338
-
339
- ssl_session_timeout 5m;
340
- ssl_protocols SSLv2 SSLv3 TLSv1.1 TLSv1.2 TLSv1.3;
341
- ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
342
- ssl_prefer_server_ciphers on;
343
-
344
- #charset koi8-r;
345
- #access_log /var/log/nginx/host.access.log main;
346
- access_log /dev/stdout main;
347
-
348
- location ~* /posidon|api/ {
349
- ```
350
-
351
- + 重启nginx
352
- 参照 4.2 启动命令
353
-
354
- ## 4.9 从中安跳转我们系统后,无法正常进入我们系统其它页面?
355
-
356
- + 问题说明:
357
-
358
- 中安单点登录进入我们系统后,由于存在中安登录信息,此时浏览器输入我们系统地址,仍会进入中安跳转时携带token认证的用户关联页面,无法查看其它页面
359
-
360
- + 解决方案
361
-
362
- 请【退出】后,浏览器重新输入我们系统地址访问
363
-
364
- ## 4.10 xxx不是文件目录问题?
365
-
366
- + 问题截图:
367
-
368
- ```text
369
- [root@Server01 redis-6.2.2]# cd
370
- [root@Server01 script]# 1l
371
- 总用量 16
372
- -rw-r--r--. 1 root root 2126 12月 9 17:04 common.sh
373
- -nwxr-xr-x. 1 root root 1049 12月 9 17:11 install.sh
374
- drwxr-xr-x. 2 root root 6 12月 9 17:19 redis-6.2.2
375
- -rw-r--r--. 1 root root 1457 12月 9 17:04 topic.sh
376
- -rw-r--r--. 1 root root 122 12月 9 17:04 upgrade.sh
377
- [root@Server01 script]# rmdir redis-6.2.2]
378
- [root@Server01 script]# ./install.sh
379
- ./install.sh:第4行:source:/home/vl.0.:是一个目录
380
- install redis to path:
381
- tar(child):/pkg/redis-6.2.2.tar.gz:无法open:没有那个文件或目录
382
- tar (child):Error is not recoverable: exiting now
383
- tar:Child returned status 2
384
- tar: Error is not recoverable: exiting now
385
- ./install.sh:第30行:cd:/home/v1.0.0source/open-source-component/redis/script/redis-6.2.2:没有那个文件或月录
386
- [root@Server01 script]#
387
- ```
388
-
389
- + 问题说明:
390
-
391
- 大概率是脚本换行符问题(目前已解决,后续应该不会出现此问题),将script 下的所有脚本都设置为unix格式,重新执行即可
392
-
393
- + 解决方法:
394
-
395
- + 步骤一: 以common.sh为例, vi common.sh
396
-
397
- ```bash
398
- vi xx.sh
399
- ```
400
-
401
- + 步骤二: 编辑模式下,输入如下指令,回车
402
-
403
- ```bash
404
- :set ff=unix
405
- ```
406
-
407
- + 步骤三: 保存并退出, 重新执行脚本
408
-
409
- ```bash
410
- :wq
411
- ```
412
-
413
-
414
- # 5.配置文件变更记录
415
-
416
- 页面配置: **最新版配置文件,请查看最新版本$APP_NAME$.tar.gz解压路径"/$APP_NAME$/pkg/assets/settings"**
417
-
418
- nginx配置: **最新版配置文件,请查看最新版本$APP_NAME$.tar.gz解压路径"/$APP_NAME$/pkg/nginx/nginx.conf"**