宽容并不等于放纵——俞吾金

安装redis

1
apt install redis

重新部署执行sh脚本

1
2
3
4
5
6
7
8
#!/bin/bash
BUILD_ID=DONTKILLME
function start(){
nohup java -jar '/test/management.jar' > '/test/management-log.txt' 2>&1 &
sleep 5s
exit
}
start

发现报错,由于Ubunutu使用dash代替了bash

1
Syntax error: "(" unexpected

按照官方文档执行

1
dpkg-reconfigure dash

然后在选择YESNO的时候,选择NO即可

添加前端项目仓库:

image-20221124143010263

构建列表添加构建步骤

1
2
cd ./management-web && yarn
cd ./management-web && yarn build:test

以及发布命令

1
cp -rp #{BUILD_RESULT_FILE} /test/manage-font/

但是我们这里还没安装node以及yarn,安装一下先

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 获取node 14
root@iZuf6afyp0j8anyom0ro8zZ:~# curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
# 安装nodejs
root@iZuf6afyp0j8anyom0ro8zZ:~# sudo apt-get install nodejs
# 查看node版本
root@iZuf6afyp0j8anyom0ro8zZ:~# node -v
v14.21.1
# 安装yarn
root@iZuf6afyp0j8anyom0ro8zZ:~# npm i yarn -g
# 查看yarn版本
root@iZuf6afyp0j8anyom0ro8zZ:~# yarn -v
1.22.19
# 配置镜像源
root@iZuf6afyp0j8anyom0ro8zZ:~# yarn config set registry "https://registry.npmmirror.com/"
yarn config v1.22.19
success Set "registry" to "https://registry.npmmirror.com/".
Done in 0.02s.

执行构建

image-20221124150111427

安装nginx

1
2
3
4
5
6
7
8
9
10
root@iZuf6afyp0j8anyom0ro8zZ:~# apt-get install nginx
# 查看版本
root@iZuf6afyp0j8anyom0ro8zZ:~# nginx -v
nginx version: nginx/1.18.0 (Ubuntu)
# 查看配置文件路径
root@iZuf6afyp0j8anyom0ro8zZ:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# 进入配置文件目录
root@iZuf6afyp0j8anyom0ro8zZ:~# cd /etc/nginx/

查看nginx.conf发现此处可以在这两个目录下配置

image-20221124151519209

进去该目录

1
root@iZuf6afyp0j8anyom0ro8zZ:~# cd /etc/nginx/sites-enabled

打开default文件

注释掉原来的配置

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
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
#server {
# listen 80 default_server;
# listen [::]:80 default_server;
#
# # SSL configuration
# #
# # listen 443 ssl default_server;
# # listen [::]:443 ssl default_server;
# #
# # Note: You should disable gzip for SSL traffic.
# # See: https://bugs.debian.org/773332
# #
# # Read up on ssl_ciphers to ensure a secure configuration.
# # See: https://bugs.debian.org/765782
# #
# # Self signed certs generated by the ssl-cert package
# # Don't use them in a production server!
# #
# # include snippets/snakeoil.conf;
#
# root /var/www/html;
#
# # Add index.php to the list if you are using PHP
# index index.html index.htm index.nginx-debian.html;
#
# server_name _;
#
# location / {
# # First attempt to serve request as file, then
# # as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
# }
#
# # pass PHP scripts to FastCGI server
# #
# #location ~ \.php$ {
# # include snippets/fastcgi-php.conf;
# #
# # # With php-fpm (or other unix sockets):
# # fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # # With php-cgi (or other tcp sockets):
# # fastcgi_pass 127.0.0.1:9000;
# #}
#
# # deny access to .htaccess files, if Apache's document root
# # concurs with nginx's one
# #
# #location ~ /\.ht {
# # deny all;
# #}
#}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}

新建文件

1
root@iZuf6afyp0j8anyom0ro8zZ:/etc/nginx/sites-enabled# touch management-font

编辑

1
2
3
4
5
6
7
8
9
10
11
12
13
server {
listen 80;
listen [::]:80;

server_name manage-font.com;

root /test/manage-font;
index index.html;

location / {
try_files $uri $uri/ /;
}
}

测试

1
2
3
4
root@iZuf6afyp0j8anyom0ro8zZ:/test# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@iZuf6afyp0j8anyom0ro8zZ:/test# nginx -s reload

访问url,成功!