Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
log-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
log-platform
Commits
fb7f9a89
Commit
fb7f9a89
authored
Jan 13, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重新设置配置文件
parent
ff6de550
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
92 deletions
+6
-92
log-manager/src/main/bin/deploy.sh
log-manager/src/main/bin/deploy.sh
+6
-92
No files found.
log-manager/src/main/bin/deploy.sh
View file @
fb7f9a89
...
...
@@ -10,35 +10,19 @@ LOCK_FILE="/tmp/deploy.lock"
# 时间变量
CDATE
=
$(
date
"+%Y-%m-%d"
)
CTIME
=
$(
date
"+%H:%M:%S"
)
PUBLISH_PATH
=
"@profiles.publish.path@"
PROJECT_NAME
=
"@project.artifactId@"
IP
=
"@profiles.server.ip@"
PORT
=
"@profiles.server.port@"
GATEWAY_PORT
=
"@profiles.server.gatewayport@"
SHELL_LOG
=
"
${
BASEDIR
}
/
${
SHELL_NAME
}
.log"
SERVICE_PATH
=
"/usr/lib/systemd/system"
JAVA_HOME
=
"/usr/local/java/jdk1.8"
SERVICE_PATH
=
"/usr/lib/systemd/system"
PUBLISH_PATH
=
"@profiles.publish.path@"
PROJECT_NAME
=
"@project.artifactId@"
NGINX_CONF_PATH
=
"/etc/nginx/conf.d/"
NGINX_PORT
=
"@profiles.nginx.port@"
NGINX_SERVER_PATH
=
"@profiles.server.path@"
PROJECT_EXECPATH
=
"
${
PUBLISH_PATH
}
/
${
PROJECT_NAME
}
"
PROJECT_UI_EXECPATH
=
"
${
PUBLISH_PATH
}
/
${
PROJECT_NAME
}
-ui/dist"
PROJECT_FILENAME
=
"
${
PROJECT_NAME
}
.tar.gz"
PROJECT_UI_FILENAME
=
"
${
PROJECT_NAME
}
-ui.tar.gz"
PROJECT_SERVICE
=
"
${
SERVICE_PATH
}
/
${
PROJECT_NAME
}
.service"
PROJECT_NGINX_CONF
=
"
${
NGINX_CONF_PATH
}
/
${
PROJECT_NAME
}
.conf"
#加锁
shell_lock
()
{
touch
${
LOCK_FILE
}
}
#删除锁
shell_unlock
()
{
rm
-f
${
LOCK_FILE
}
}
#写日志
writelog
()
{
LOGINFO
=
$1
...
...
@@ -54,16 +38,6 @@ clear_deploy() {
rm
-rf
${
SERVICE
}
#清理执行文件目录
rm
-rf
${
EXECPATH
}
#清理nginx服务配置文件
rm
-f
${
NGINX_CONF_PATH
}
/
${
PROJECT_NAME
}
.conf
mkdir
-p
${
EXECPATH
}
}
#清理ui
clear_ui_deploy
()
{
EXEC_UI_PATH
=
$1
rm
-rf
${
EXEC_UI_PATH
}
mkdir
-p
${
EXEC_UI_PATH
}
}
build_service
()
{
...
...
@@ -86,61 +60,14 @@ build_service() {
writelog
"
${
PROJECT_NAME
}
服务创建完成!"
}
build_nginx
()
{
echo
"server{
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable
\"
MSIE [1-6]
\.\"
;
listen
${
NGINX_PORT
}
;
#server_name localhost;
location / {
root
${
PROJECT_UI_EXECPATH
}
;
index index.html index.htm;
}
location
${
NGINX_SERVER_PATH
}
/ {
proxy_pass http://
${
IP
}
:
${
GATEWAY_PORT
}
;
proxy_set_header Host
\$
host;
proxy_set_header X-Real-IP
\$
remote_addr;
proxy_set_header X-Forwarded-For
\$
proxy_add_x_forwarded_for;
}
location /doc/ {
root
${
PROJECT_EXECPATH
}
;
index api.html;
}
location /file/fileupload/ {
alias /mortals/app/data/file/fileupload/;
autoindex on;
autoindex_exact_size off;
}
location /file/uploadfile/ {
alias /mortals/app/data/file/uploadfile/;
autoindex on;
autoindex_exact_size off;
}
location /file/preview/ {
alias /mortals/app/data/file/preview/;
autoindex on;
autoindex_exact_size off;
}
}
"
>
${
PROJECT_NGINX_CONF
}
}
#启动服务与nginx
start_service_and_nginx
()
{
writelog
"
${
PROJECT_NAME
}
服务启动..."
start_service
()
{
systemctl
enable
${
PROJECT_NAME
}
systemctl daemon-reload
writelog
"
${
PROJECT_NAME
}
服务启动..."
systemctl stop
${
PROJECT_NAME
}
&&
systemctl start
${
PROJECT_NAME
}
project_status
=
$(
systemctl status
"
${
PROJECT_NAME
}
"
|grep Active |awk
'{print $2}'
)
nginx
-t
nginx
-s
reload
jcpid
=
$(
ps
-ef
|
grep
-v
"grep"
|
grep
"
${
PROJECT_NAME
}
"
|
awk
'{print $2}'
)
writelog
"
${
PROJECT_NAME
}
服务启动,PID is
${
jcpid
}
,status:
${
project_status
}
"
}
...
...
@@ -149,29 +76,16 @@ project_deploy() {
writelog
"
${
PROJECT_NAME
}
_deploy"
clear_deploy
${
PROJECT_SERVICE
}
${
PROJECT_EXECPATH
}
writelog
"
${
PROJECT_NAME
}
_clear_finish"
tar
-zvxf
./
${
PROJECT_FILENAME
}
-C
${
PUBLISH_PATH
}
build_service
${
PROJECT_SERVICE
}
${
PROJECT_EXECPATH
}
build_nginx
start_service_and_nginx
start_service
writelog
"
${
PROJECT_NAME
}
_deploy_finish"
}
#部署前台服务
project_ui_deploy
()
{
writelog
"
${
PROJECT_NAME
}
_ui_deploy"
clear_ui_deploy
${
PROJECT_UI_EXECPATH
}
tar
-zvxf
./
${
PROJECT_UI_FILENAME
}
-C
${
PUBLISH_PATH
}
writelog
"
${
PROJECT_NAME
}
_ui_deploy_finish"
}
#主函数
main
()
{
echo
"后台服务部署"
project_deploy
echo
"前端服务部署"
project_ui_deploy
exit
${
RETVAL
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment