Commit 198e4faf authored by 赵啸非's avatar 赵啸非

重新设置配置文件

parent 08aa0aa5
......@@ -7,8 +7,6 @@
<format>tar.gz</format>
</formats>
<!-- <includeBaseDirectory>false</includeBaseDirectory>-->
<!-- 需要打包的文件集 -->
<fileSets>
<fileSet>
......
......@@ -6,11 +6,10 @@
<formats>
<format>tar.gz</format>
</formats>
<!-- <includeBaseDirectory>false</includeBaseDirectory>-->
<fileSets>
<fileSet>
<directory>${project.parent.basedir}/dist/${project.parent.artifactId}/bin</directory>
<directory>target/bin</directory>
<outputDirectory>bin</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
......@@ -20,9 +19,19 @@
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>${project.parent.basedir}/dist/${project.parent.artifactId}/db</directory>
<directory>./db</directory>
<includes>
<include>*.sql</include>
</includes>
<outputDirectory>db</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${project.artifactId}-${project.version}.jar</source>
<outputDirectory>boot</outputDirectory>
</file>
</files>
</assembly>
\ No newline at end of file
# 测试环境配置
NODE_ENV = 'production'
NODE_ENV = 'test'
# 地址
VUE_APP_BASE_API = http://192.168.0.98:11091/m
......
......@@ -5,7 +5,7 @@
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-cli-service build",
"stage": "vue-cli-service build --mode stage",
"test": "vue-cli-service build --mode test",
"build:prod": "vue-cli-service build --model prod"
},
"dependencies": {
......
......@@ -2878,9 +2878,9 @@ core-js@^2.4.0:
integrity sha1-2TM9+nsGXjR8xWgiGdb2kIWcwuw=
core-js@^3.6.5:
version "3.25.5"
resolved "https://registry.npmmirror.com/core-js/-/core-js-3.25.5.tgz#e86f651a2ca8a0237a5f064c2fe56cef89646e27"
integrity sha512-nbm6eZSjm+ZuBQxCUPQKQCoUEfFOXjUZ8dTTyikyKaWrTYmAVbykQfwsKE5dBK88u3QCkCrzsx/PPlKfhsvgpw==
version "3.26.0"
resolved "https://registry.npmmirror.com/core-js/-/core-js-3.26.0.tgz#a516db0ed0811be10eac5d94f3b8463d03faccfe"
integrity sha512-+DkDrhoR4Y0PxDz6rurahuB+I45OsEUv8E1maPTB6OuHRohMMcznBq9TMpdpDMm/hUPob/mJJS3PqgbHpMTQgw==
core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2"
......
......@@ -24,25 +24,23 @@
<profiles.active>develop</profiles.active>
<profiles.server.port>18225</profiles.server.port>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://localhost:3306/log-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<![CDATA[jdbc:mysql://127.0.0.1:3306/log-platform?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>12345678</profiles.datasource.password>
<profiles.redis.uri>127.0.0.1</profiles.redis.uri>
<profiles.redis.port>6379</profiles.redis.port>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.password></profiles.redis.password>
<profiles.redis.database>8</profiles.redis.database>
<profiles.redis.database>9</profiles.redis.database>
<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>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange>
<profiles.filepath>/mortals/data</profiles.filepath>
<profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.log.level>DEBUG</profiles.log.level>
<profiles.log.path>/logs</profiles.log.path>
<profiles.data.path>/data</profiles.data.path>
<!-- <profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>-->
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
......@@ -54,8 +52,11 @@
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
<profiles.server.ip>192.168.0.98</profiles.server.ip>
<profiles.server.port>18225</profiles.server.port>
<profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.nginx.port>11091</profiles.nginx.port>
<profiles.server.path>/logservice</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://192.168.0.98:3306/log-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username>
......@@ -64,34 +65,33 @@
<profiles.redis.port>6379</profiles.redis.port>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.password>hotel@2020</profiles.redis.password>
<profiles.redis.database>3</profiles.redis.database>
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.redis.database>9</profiles.redis.database>
<profiles.rabbitmq.host>192.168.0.98</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>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange>
<profiles.filepath>/mortals/data</profiles.filepath>
<profiles.log.level>INFO</profiles.log.level>
<profiles.data.path>/data</profiles.data.path>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
<package.environment>stage</package.environment>
<skipDeploy>true</skipDeploy>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.filepath>/mortals/app/data</profiles.filepath>
<package.environment>test</package.environment>
<skipDeploy>false</skipDeploy>
</properties>
</profile>
<profile>
<id>product</id>
<properties>
<profiles.active>product</profiles.active>
<profiles.server.port>18225</profiles.server.port>
<profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.server.ip>192.168.0.251</profiles.server.ip>
<profiles.server.port>11078</profiles.server.port>
<profiles.nginx.port>11092</profiles.nginx.port>
<profiles.server.path>/sampleform</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://127.0.0.1:3306/log-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<![CDATA[jdbc:mysql://127.0.0.1:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>xhx@2022</profiles.datasource.password>
<profiles.redis.uri>127.0.0.1</profiles.redis.uri>
......@@ -99,22 +99,18 @@
<profiles.redis.username></profiles.redis.username>
<profiles.redis.password>12345678</profiles.redis.password>
<profiles.redis.database>9</profiles.redis.database>
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange></profiles.rabbitmq.exchange>
<profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.log.level>INFO</profiles.log.level>
<profiles.data.path>/data</profiles.data.path>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
<package.environment>build:prod</package.environment>
<profiles.filepath>/mortals/app/data</profiles.filepath>
<package.environment>build</package.environment>
<skipDeploy>false</skipDeploy>
</properties>
</profile>
......@@ -237,27 +233,36 @@
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/bin</outputDirectory>
<outputDirectory>target/bin
</outputDirectory>
<resources>
<resource>
<directory>src/main/bin/</directory>
<excludes>
<exclude>deploy.sh</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-db</id>
<id>copy-deploy</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/db</outputDirectory>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}/
</outputDirectory>
<resources>
<resource>
<directory>../db/</directory>
<directory>src/main/bin</directory>
<includes>
<include>deploy.sh</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
......@@ -274,7 +279,6 @@
<skip>${skipDeploy}</skip>
</configuration>
<executions>
<!--执行npm install-->
<execution>
<id>exec-npm-install</id>
<phase>generate-resources</phase>
......@@ -282,11 +286,14 @@
<goal>exec</goal>
</goals>
<configuration>
<executable>npm install</executable>
<executable>yarn</executable>
<arguments>
<argument></argument>
</arguments>
<workingDirectory>${project.parent.basedir}/log-manager-ui/admin</workingDirectory>
</configuration>
</execution>
<!--执行npm build-->
<execution>
<id>exec-npm-run-build</id>
<phase>generate-resources</phase>
......@@ -294,7 +301,7 @@
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<executable>yarn</executable>
<arguments>
<argument>run</argument>
<arguments>${package.environment}</arguments>
......@@ -319,12 +326,12 @@
<goal>single</goal>
</goals>
<configuration>
<finalName>log-platform</finalName>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>../assembly/assembly.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/dist/log-platform</outputDirectory>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
</configuration>
</execution>
<execution>
......@@ -334,12 +341,12 @@
<goal>single</goal>
</goals>
<configuration>
<finalName>log-platform-ui</finalName>
<finalName>${project.artifactId}-ui</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>../assembly/assembly-ui.xml</descriptor>
<descriptor>../assembly/assembly-manager-ui.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/dist/log-platform</outputDirectory>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
</configuration>
</execution>
</executions>
......
#!/bin/sh
RETVAL=$?
SHELL_NAME=$0
BASEDIR=$(dirname $0)
BASEDIR=$( (
cd "$BASEDIR"
pwd
))
LOCK_FILE="/tmp/deploy.lock"
# 时间变量
LOG_DATE='date "+%Y-%m-%d"'
LOG_TIME='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"
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_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
echo "${CDATE} ${CTIME}: ${SHELL_NAME} : ${LOGINFO}" >>${SHELL_LOG}
echo ${LOGINFO}
}
#清理目标
clear_deploy() {
SERVICE=$1
EXECPATH=$2
#清理后台自启服务
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() {
SERVICE=$1
EXECPATH=$2
echo "" >${SERVICE}
echo "[Unit]" >>${SERVICE}
echo "Description=${PROJECT_NAME}" >>${SERVICE}
echo "After=network.target" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Service]" >>${SERVICE}
echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
echo "Type=forking" >>${SERVICE}
echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
echo "PrivateTmp=true" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Install]" >>${SERVICE}
echo "WantedBy=multi-user.target" >>${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}/dist;
index index.html index.htm;
}
location ${NGINX_SERVER_PATH} {
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 /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}服务启动..."
systemctl enable ${PROJECT_NAME}
systemctl daemon-reload
systemctl stop ${PROJECT_NAME}
systemctl start ${PROJECT_NAME}
nginx -t
nginx -s reload
jcpid=$(ps -ef | grep -v "grep" | grep "${PROJECT_NAME} " | awk '{print $2}')
writelog "${PROJECT_NAME}服务启动,PID is ${jcpid}"
}
#部署后台服务
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
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}
}
main $1
#! /bin/sh
PORT="@profiles.server.port@"
BASEDIR=`dirname $0`
BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@"
MAIN_CLASS="$PROJECT_NAME";
if [ ! -n "$PORT" ]; then
echo $"Usage: $0 {port}"
exit $FAIL
fi
echo "stoping application $PROJECT_NAME......"
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME is not started or has been stopped!"
else
curl -X POST -i -u $SECURITY_USERNAME:$SECURITY_PASSWORD http://127.0.0.1:$PORT/xxx_manager/shutdown
for i in {1..60}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME has been stopped!"
break
else
echo "stoping the application .. $i"
sleep 1
fi
done
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
[ -z $jcpid ] || kill -15 $jcpid
for i in {1..30}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME has been stopped!"
break
else
echo "stoping the application .. $i"
sleep 1
fi
done
fi
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
[ -z $jcpid ] || kill -9 $jcpid
[ $? -eq 0 ] && echo "Stop $PROJECT_NAME OK!" || echo "Stop $PROJECT_NAME Fail!"
fi
fi
......@@ -3,6 +3,7 @@ spring:
allow-bean-definition-overriding: true
application:
log:
level:@profiles.log.level@
level: @profiles.log.level@
path: @profiles.log.path@
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