宽容并不等于放纵——俞吾金
安装redis
apt install redis
重新部署执行sh
脚本
#!/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
:
Syntax error: "(" unexpected
按照官方文档执行
代码语言:javascript复制dpkg-reconfigure dash
然后在选择YES
和NO
的时候,选择NO
即可
添加前端项目仓库:
构建列表添加构建步骤
代码语言:javascript复制cd ./management-web && yarn
cd ./management-web && yarn build:test
以及发布命令
代码语言:javascript复制cp -rp #{BUILD_RESULT_FILE} /test/manage-font/
但是我们这里还没安装node
以及yarn
,安装一下先
# 获取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.
执行构建
安装nginx
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
发现此处可以在这两个目录下配置
进去该目录
代码语言:javascript复制root@iZuf6afyp0j8anyom0ro8zZ:~# cd /etc/nginx/sites-enabled
打开default
文件
注释掉原来的配置
代码语言:javascript复制##
# 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;
# }
#}
新建文件
代码语言:javascript复制root@iZuf6afyp0j8anyom0ro8zZ:/etc/nginx/sites-enabled# touch management-font
编辑
代码语言:javascript复制server {
listen 80;
listen [::]:80;
server_name manage-font.com;
root /test/manage-font;
index index.html;
location / {
try_files $uri $uri/ /;
}
}
测试
代码语言:javascript复制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
,成功!