前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Jpom新建仓库部署前端项目

Jpom新建仓库部署前端项目

作者头像
阿超
发布2022-12-05 15:24:37
3800
发布2022-12-05 15:24:37
举报
文章被收录于专栏:快乐阿超

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

安装redis

代码语言:javascript
复制
apt install redis

重新部署执行sh脚本

代码语言:javascript
复制
#!/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

代码语言:javascript
复制
Syntax error: "(" unexpected

按照官方文档执行

代码语言:javascript
复制
dpkg-reconfigure dash

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

添加前端项目仓库:

image-20221124143010263
image-20221124143010263

构建列表添加构建步骤

代码语言:javascript
复制
cd ./management-web && yarn
cd ./management-web && yarn build:test

以及发布命令

代码语言:javascript
复制
cp -rp #{BUILD_RESULT_FILE} /test/manage-font/

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

代码语言:javascript
复制
# 获取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
image-20221124150111427

安装nginx

代码语言:javascript
复制
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
image-20221124151519209

进去该目录

代码语言: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,成功!

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-12-02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档