Commit 679a45b2 authored by “yiyousong”'s avatar “yiyousong”
parents 667403bc 1fdfb9ee
# 生产环境配置
NODE_ENV = production
VUE_APP_API_BASE_URL=/basics_api
VUE_APP_API_portal_URL=/portal_home
#宜宾环境
NODE_ENV = "production"
VUE_APP_API_BASE_URL=/basics_api
VUE_APP_API_portal_URL=/portal_home
\ No newline at end of file
......@@ -25,10 +25,6 @@
</activation>
<properties>
<profiles.active>develop</profiles.active>
<profiles.server.ip>127.0.0.1</profiles.server.ip>
<profiles.server.port>17211</profiles.server.port>
<profiles.nginx.port>11071</profiles.nginx.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/zwfw</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
......@@ -49,10 +45,6 @@
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
<profiles.server.ip>192.168.0.98</profiles.server.ip>
<profiles.server.port>17211</profiles.server.port>
<profiles.nginx.port>11071</profiles.nginx.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/base</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>192.168.0.98</profiles.rabbitmq.host>
......@@ -73,10 +65,6 @@
<id>product</id>
<properties>
<profiles.active>test</profiles.active>
<profiles.server.ip>192.168.0.251</profiles.server.ip>
<profiles.server.port>17211</profiles.server.port>
<profiles.nginx.port>11071</profiles.nginx.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/base</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host>
......@@ -98,13 +86,9 @@
<id>yibin</id>
<properties>
<profiles.active>yibin</profiles.active>
<profiles.server.ip>192.168.2.144</profiles.server.ip>
<profiles.server.port>17211</profiles.server.port>
<profiles.nginx.port>11071</profiles.nginx.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/base</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>192.168.2.144</profiles.rabbitmq.host>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
......
......@@ -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,9 +38,6 @@ clear_deploy() {
rm -rf ${SERVICE}
#清理执行文件目录
rm -rf ${EXECPATH}
#清理nginx服务配置文件
rm -f ${NGINX_CONF_PATH}/${PROJECT_NAME}.conf
mkdir -p ${EXECPATH}
}
#清理ui
......@@ -86,62 +67,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}"
}
......@@ -150,11 +83,8 @@ 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"
}
......
#宜宾环境
NODE_ENV = "production"
VUE_APP_API_BASE_URL=http://192.168.3.24:11078
\ No newline at end of file
VUE_APP_API_BASE_URL=/basics_api
\ No newline at end of file
......@@ -22,7 +22,6 @@
</activation>
<properties>
<profiles.active>develop</profiles.active>
<profiles.server.port>17212</profiles.server.port>
<profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
......@@ -42,10 +41,6 @@
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
<profiles.server.ip>192.168.0.98</profiles.server.ip>
<profiles.server.port>17212</profiles.server.port>
<profiles.nginx.port>11072</profiles.nginx.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/zwfw</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>192.168.0.98</profiles.rabbitmq.host>
......@@ -57,7 +52,7 @@
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>test</package.environment>
<skipDeploy>false</skipDeploy>
</properties>
......@@ -66,10 +61,6 @@
<id>product</id>
<properties>
<profiles.active>product</profiles.active>
<profiles.server.ip>192.168.0.251</profiles.server.ip>
<profiles.server.port>17212</profiles.server.port>
<profiles.nginx.port>11072</profiles.nginx.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/zwfw</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
......@@ -91,10 +82,6 @@
<id>yibin</id>
<properties>
<profiles.active>yibin</profiles.active>
<profiles.server.ip>192.168.2.144</profiles.server.ip>
<profiles.server.port>17212</profiles.server.port>
<profiles.nginx.port>11072</profiles.nginx.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/zwfw</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
......@@ -106,7 +93,7 @@
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>yibin</package.environment>
<skipDeploy>false</skipDeploy>
</properties>
......
......@@ -10,40 +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"
MYSQL_HOST="127.0.0.1"
MYSQL_PORT="3306"
MYSQL_USER="root"
MYSQL_PASSWORD="xhx@2022"
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
......@@ -59,9 +38,6 @@ clear_deploy() {
rm -rf ${SERVICE}
#清理执行文件目录
rm -rf ${EXECPATH}
#清理nginx服务配置文件
rm -f ${NGINX_CONF_PATH}/${PROJECT_NAME}.conf
mkdir -p ${EXECPATH}
}
#清理ui
......@@ -91,62 +67,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
project_status=$(systemctl status "${PROJECT_NAME}"|grep Active |awk '{print $2}')
jcpid=$(ps -ef | grep -v "grep" | grep "${PROJECT_NAME} " | awk '{print $2}')
writelog "${PROJECT_NAME}服务启动,PID is ${jcpid} ,status:${project_status}"
}
......@@ -155,11 +83,8 @@ 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"
}
......@@ -169,13 +94,7 @@ project_ui_deploy() {
clear_ui_deploy ${PROJECT_UI_EXECPATH}
tar -zvxf ./${PROJECT_UI_FILENAME} -C ${PUBLISH_PATH}
writelog "${PROJECT_NAME}_ui_deploy_finish"
}
init_db() {
writelog "${PROJECT_NAME}_db_init"
mysql -h${MYSQL_HOST} -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PASSWORD} <${EXECPATH}/db/db.sql
mysql -h${MYSQL_HOST} -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PASSWORD} <${EXECPATH}/db/menu.sql
writelog "${PROJECT_NAME}_db_init"
}
#主函数
......@@ -187,32 +106,4 @@ main() {
exit ${RETVAL}
}
init_params(){
#获取参数
while getopts h:P:u:p opt; do
case $opt in
h)
#echo "-mysql-host ---- $OPTARG"
MYSQL_HOST=$OPTARG
;;
P)
#echo "-mysql-port ---- $OPTARG"
MYSQL_PORT=$OPTARG
;;
u)
#echo "-mysql-user ---- $OPTARG"
MYSQL_USER=$OPTARG
;;
p)
#echo "-mysql-password ---- $OPTARG"
MYSQL_PASSWORD=$OPTARG
;;
?)
echo "$opt is an invalid option"
;;
esac
done
}
main $1
......@@ -10,34 +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@"
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"
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
......@@ -53,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() {
......@@ -85,59 +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 / {
proxy_pass http://${IP}:${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 /homeDeviceUrl/ {
alias /home/publish/device-manager-ui/homeDeviceUrl/;
index index.html index.htm;
}
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}"
}
......@@ -146,19 +76,12 @@ 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}
writelog "${PROJECT_NAME}_deploy_build_nginx"
build_nginx
writelog "${PROJECT_NAME}_deploy_build_nginx_finish"
writelog "${PROJECT_NAME}_deploy_build_service_finish"
start_service_and_nginx
start_service
writelog "${PROJECT_NAME}_deploy_finish"
}
#主函数
main() {
echo "后台服务部署"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment