@wjwjq/release-helper 0.2.5 → 0.2.7

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 (33) hide show
  1. package/dist/deploy/pkg/nginx_binary/compile.sh +39 -0
  2. package/dist/deploy/pkg/nginx_binary/nginx-arm-ssl1.1.1.tar.gz +0 -0
  3. package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.0.2.tar.gz +0 -0
  4. package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.1.1.tar.gz +0 -0
  5. package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl3.0.7.tar.gz +0 -0
  6. package/dist/deploy/script/common.sh +68 -15
  7. package/dist/deploy/script/install.sh +1 -1
  8. package/dist/deploy/script/nginx.sh +52 -54
  9. package/dist/deploy/script/upgrade.sh +1 -1
  10. package/package.json +1 -1
  11. package/dist/deploy/pkg/nginx_binary/g++/gcc-c++-4.8.5-39.el7.x86_64.rpm +0 -0
  12. package/dist/deploy/pkg/nginx_binary/g++/libstdc++-4.8.5-39.el7.x86_64.rpm +0 -0
  13. package/dist/deploy/pkg/nginx_binary/gcc/cpp-4.8.5-39.el7.x86_64.rpm +0 -0
  14. package/dist/deploy/pkg/nginx_binary/gcc/gcc-4.8.5-39.el7.x86_64.rpm +0 -0
  15. package/dist/deploy/pkg/nginx_binary/gcc/glibc-devel-2.17-307.el7.1.x86_64.rpm +0 -0
  16. package/dist/deploy/pkg/nginx_binary/gcc/glibc-headers-2.17-307.el7.1.x86_64.rpm +0 -0
  17. package/dist/deploy/pkg/nginx_binary/gcc/kernel-headers-3.10.0-1127.el7.x86_64.rpm +0 -0
  18. package/dist/deploy/pkg/nginx_binary/gcc/libmpc-1.0.1-3.el7.x86_64.rpm +0 -0
  19. package/dist/deploy/pkg/nginx_binary/gcc/mpfr-3.1.1-4.el7.x86_64.rpm +0 -0
  20. package/dist/deploy/pkg/nginx_binary/nginx-1.22.1.tar.gz +0 -0
  21. package/dist/deploy/pkg/nginx_binary/openssl/keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm +0 -0
  22. package/dist/deploy/pkg/nginx_binary/openssl/krb5-devel-1.15.1-46.el7.x86_64.rpm +0 -0
  23. package/dist/deploy/pkg/nginx_binary/openssl/krb5-libs-1.15.1-46.el7.x86_64.rpm +0 -0
  24. package/dist/deploy/pkg/nginx_binary/openssl/libcom_err-devel-1.42.9-17.el7.x86_64.rpm +0 -0
  25. package/dist/deploy/pkg/nginx_binary/openssl/libkadm5-1.15.1-46.el7.x86_64.rpm +0 -0
  26. package/dist/deploy/pkg/nginx_binary/openssl/libselinux-devel-2.5-15.el7.x86_64.rpm +0 -0
  27. package/dist/deploy/pkg/nginx_binary/openssl/libverto-devel-0.2.5-4.el7.x86_64.rpm +0 -0
  28. package/dist/deploy/pkg/nginx_binary/openssl/openssl-1.0.2k-19.el7.x86_64.rpm +0 -0
  29. package/dist/deploy/pkg/nginx_binary/openssl/openssl-devel-1.0.2k-19.el7.x86_64.rpm +0 -0
  30. package/dist/deploy/pkg/nginx_binary/pcre/pcre-8.32-17.el7.x86_64.rpm +0 -0
  31. package/dist/deploy/pkg/nginx_binary/pcre/pcre-devel-8.32-17.el7.x86_64.rpm +0 -0
  32. package/dist/deploy/pkg/nginx_binary/zlib/zlib-1.2.7-18.el7.x86_64.rpm +0 -0
  33. package/dist/deploy/pkg/nginx_binary/zlib/zlib-devel-1.2.7-18.el7.x86_64.rpm +0 -0
@@ -0,0 +1,39 @@
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.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
+ cd /etc || exit
36
+
37
+ tar -zcvf nginx-"$arch"-ssl"$ssl_version".tar.gz nginx/ -C /root
38
+
39
+ echo "-----------pack at: /root nginx-"$arch"-ssl"$ssl_version".tar.gz--------------"
@@ -24,6 +24,13 @@ log_success() {
24
24
  echo "$now: [success] $1" >>"$execute_log_path"
25
25
  }
26
26
 
27
+ log_warn() {
28
+ now=$(date "+%Y-%m-%d %H:%M:%S")
29
+ echo "$(tput setaf 3)""$now": "$1""$(tput sgr0)"
30
+
31
+ echo "$now: [success] $1" >>"$execute_log_path"
32
+ }
33
+
27
34
  log_error() {
28
35
  now=$(date "+%Y-%m-%d %H:%M:%S")
29
36
  echo "$(tput setaf 1)""$now": "$1" "$(tput sgr0)"
@@ -132,7 +139,31 @@ install_assets() {
132
139
 
133
140
  }
134
141
 
142
+ now=$(date "+%Y-%m-%d_%H:%M:%S")
143
+ time=$now
144
+ old_version=$(get_old_version)
145
+
146
+ backup(){
147
+ source_type=$1
148
+
149
+ #备份整个服务 eg: /opt/posidon-frontend
150
+ if [[ -n "${old_version}" ]]; then
151
+ backup_dir="$install_path"backup
152
+ mkdir -p $backup_dir
153
+
154
+ # 分开备份nginx 和assets
155
+ backup_path=$backup_dir"/"$old_version"_"$time
156
+ mkdir -p "$backup_path"
157
+
158
+ echo "${app_name} $source_type backup at: $backup_path"
159
+ mv "$install_path$source_type" "$backup_path"
160
+ fi
161
+ }
162
+
163
+
135
164
  start() {
165
+ callBy=$1
166
+
136
167
  # 仅静态文件
137
168
  if [[ "${mode}" != 3 ]]; then
138
169
  # 未安装
@@ -168,29 +199,51 @@ start() {
168
199
 
169
200
  # 创建用户
170
201
  create_user_csri
171
-
172
- now=$(date "+%Y-%m-%d_%H:%M:%S")
173
- old_version=$(get_old_version)
174
-
175
- #备份整个服务 eg: /opt/posidon-frontend
176
- if [[ -n "${old_version}" ]]; then
177
- parent_store_path=$(echo "$install_path" | sed -e "s/\/${app_name}//")
178
- backup_path=$parent_store_path""$app_name"_"$old_version"_"$now
179
- echo "${app_name} assets backup at: $backup_path"
180
- mv "$install_path" "$backup_path"
181
- fi
182
-
183
202
  mkdir -p "$install_path"
184
203
 
204
+
185
205
  # 仅静态文件
186
206
  if [[ "${mode}" != 3 ]]; then
187
- copy_nginx_conf_and_write_verison
188
- add_nginx_service
189
- add_log_rotate
207
+ if [ -f "${nginx_conf_path}" ]; then
208
+ while true; do
209
+ read -r -p "nginx.conf file already exists, update it?[Y/N]" yn
210
+ case $yn in
211
+ [Yy]*)
212
+ # 备份nginx配置目录
213
+ backup nginx;
214
+
215
+ copy_nginx_conf_and_write_verison
216
+ add_nginx_service
217
+ add_log_rotate
218
+
219
+ if [[ $? != 0 ]]; then
220
+ echo "$(tput setaf 1)"failed to update nginx.conf!"$(tput sgr0)"
221
+ exit 1
222
+ else
223
+ log_warn "!!!!!!!!!nginx.conf has been updated, please note the changes, such as port 5443 !!!!!!!!!!"
224
+ fi
225
+ break
226
+ ;;
227
+ [Nn]*) break ;;
228
+ *) echo "Please answer yes or no." ;;
229
+ esac
230
+ done
231
+ else
232
+ copy_nginx_conf_and_write_verison
233
+ add_nginx_service
234
+ add_log_rotate
235
+ fi
190
236
  fi
191
237
 
238
+ # 备份静态资源目录
239
+ backup assets;
240
+
192
241
  install_assets
193
242
 
243
+ # 修改/etc/nginx 用户(组)
244
+ chown -R $user:$usergroup "$nginx_binary_install_path"
245
+ chmod 744 -R "$nginx_binary_install_path"
246
+
194
247
  # 修改所属用户
195
248
  chown -R $user:$usergroup "$install_path"
196
249
  chmod 744 -R "$install_path"
@@ -4,4 +4,4 @@ basepath=$(dirname "$(realpath "${BASH_SOURCE[-1]}")")
4
4
 
5
5
  source "$basepath"/common.sh
6
6
 
7
- start
7
+ start 'install'
@@ -241,66 +241,65 @@ install_nginx_binary() {
241
241
  arch=$(uname -m)
242
242
  ssl_version=$(openssl version | grep -oP '\d+\.\d+' | sed -n '1p' 2>&1)
243
243
 
244
- # if [[ -z "${arch}" ]]; then
245
- # arch="x86_64"
246
- # fi
247
-
248
- # if [[ $arch == arm* ]] || [[ $arch = aarch64 ]]; then
249
- # arch="arm"
250
- # fi
244
+ if [[ -z "${arch}" ]]; then
245
+ arch="x86_64"
246
+ fi
251
247
 
252
- # if [[ "${ssl_version}" == "1.0" ]]; then
253
- # ssl_version="1.0.2"
254
- # fi
248
+ if [[ $arch == arm* ]] || [[ $arch = aarch64 ]]; then
249
+ arch="arm"
250
+ fi
255
251
 
256
- # if [[ "${ssl_version}" == "1.1" ]]; then
257
- # ssl_version="1.1.1"
258
- # fi
252
+ if [[ "${ssl_version}" == "1.0" ]]; then
253
+ ssl_version="1.0.2"
254
+ fi
259
255
 
260
- # if [[ "${ssl_version}" == "3.0" ]]; then
261
- # ssl_version="3.0.7"
262
- # fi
256
+ if [[ "${ssl_version}" == "1.1" ]]; then
257
+ ssl_version="1.1.1"
258
+ fi
263
259
 
264
- # if [[ -z "${ssl_version}" ]]; then
265
- # ssl_version="1.0.2"
266
- # fi
260
+ if [[ "${ssl_version}" == "3.0" ]]; then
261
+ ssl_version="3.0.7"
262
+ fi
267
263
 
268
- # pkg="$nginx_binary_pkg_path"/nginx-"$arch"-ssl"$ssl_version".tar.gz
264
+ if [[ -z "${ssl_version}" ]]; then
265
+ ssl_version="1.0.2"
266
+ fi
269
267
 
270
- # if [ ! -f "$pkg" ]; then
271
- # log_error "Fatal error: nginx-$arch-ssl$ssl_version.tar.gz not matched! contact developer!"
272
- # exit 1
273
- # fi
268
+ pkg="$nginx_binary_pkg_path"/nginx-"$arch"-ssl"$ssl_version".tar.gz
274
269
 
275
- # log "current arch: $arch, current ssl_version: $ssl_version"
270
+ if [ ! -f "$pkg" ]; then
271
+ log_error "Fatal error: nginx-$arch-ssl$ssl_version.tar.gz not matched! contact developer!"
272
+ exit 1
273
+ fi
276
274
 
277
- # tar -zxvhf "$pkg" -C "$nginx_binary_install_path" --strip-components 1
275
+ log "current arch: $arch, current ssl_version: $ssl_version"
278
276
 
277
+ tar -zxvhf "$pkg" -C "$nginx_binary_install_path" --strip-components 1
279
278
 
280
- check_dependency
281
- # 检测是否安装成功
282
- if [[ $? == 0 ]]; then
283
- log_success "dependency installation successfully!"
284
- else
285
- log_error "dependency installation failed!"
286
- fi
279
+ # check_dependency
280
+ # # 检测是否安装成功
281
+ # if [[ $? == 0 ]]; then
282
+ # log_success "dependency installation successfully!"
283
+ # else
284
+ # log_error "dependency installation failed!"
285
+ # fi
287
286
 
288
- log "start to complie and install nginx"
289
-
290
- tar_name=$(ls ${nginx_binary_pkg_path}|grep nginx-.*.tar.gz)
291
- tar_dir=${tar_name%.tar.gz*}
292
- tar -zxvf "${nginx_binary_pkg_path}"/"${tar_name}"
293
- cd "${tar_dir}"
294
-
295
- ./configure \
296
- --prefix=${nginx_binary_install_path} \
297
- --with-http_ssl_module \
298
- --with-http_v2_module \
299
- --with-http_gzip_static_module \
300
- --with-http_stub_status_module \
301
- --with-stream
302
-
303
- make && make install
287
+ # log "start to complie and install nginx"
288
+
289
+ # tar_name=$(ls ${nginx_binary_pkg_path}|grep nginx-.*.tar.gz)
290
+ # tar_dir=${tar_name%.tar.gz*}
291
+ # tar -zxvf "${nginx_binary_pkg_path}"/"${tar_name}"
292
+ # cd "${tar_dir}"
293
+
294
+ # ./configure \
295
+ # --prefix=${nginx_binary_install_path} \
296
+ # --with-http_ssl_module \
297
+ # --with-http_v2_module \
298
+ # --with-http_gzip_static_module \
299
+ # --with-http_stub_status_module \
300
+ # --with-stream
301
+
302
+ # make && make install
304
303
  # 检测是否安装成功
305
304
  if [[ $? == 0 ]]; then
306
305
  log_success "nginx installation successfully!"
@@ -308,14 +307,13 @@ install_nginx_binary() {
308
307
  log_error "nginx installation failed!"
309
308
  fi
310
309
 
311
- cp $nginx_binary_install_path/conf/mime.types $nginx_binary_install_path
310
+ # cp $nginx_binary_install_path/conf/mime.types $nginx_binary_install_path
312
311
 
313
312
  mkdir -p /usr/local/bin
313
+ mkdir -p /var/log/nginx
314
314
  ln -sf "$nginx_binary_install_path"sbin/nginx /usr/sbin/nginx
315
- cd ..
315
+ # cd ..
316
+
316
317
 
317
- # 修改/etc/nginx 用户(组)
318
- chown -R $user:$usergroup "$nginx_binary_install_path"
319
- chmod 744 -R "$nginx_binary_install_path"
320
318
  }
321
319
  #------------------------------------ nginx 可执行程序相关 end ----------------------------------
@@ -4,4 +4,4 @@ basepath=$(dirname "$(realpath "${BASH_SOURCE[-1]}")")
4
4
 
5
5
  source "$basepath"/common.sh
6
6
 
7
- start
7
+ start 'upgrade'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjwjq/release-helper",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "generate deployment package for frontend, include nginx...",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",