diff --git a/assembly/assembly.xml b/assembly/assembly.xml new file mode 100644 index 0000000000000000000000000000000000000000..32797e91ee6541662f4e2e1950193bd64002fafc --- /dev/null +++ b/assembly/assembly.xml @@ -0,0 +1,79 @@ + + + ${package.environment} + + + + + + + + dir + zip + + + true + + + + + lib + runtime + + + + + + + + deploy/env/${package.environment}/bin + bin + + *.sh + + 0755 + unix + + + ${project.build.directory} + lib + + ${project.artifactId}-*.jar + + + + deploy/env/${package.environment}/conf + res + + + + ${project.build.directory}/classes + res + + transaction.xml + + + + ${project.build.directory}/classes/layout + res/layout + + + ${project.build.directory}/classes/static + res/static + + + ${project.build.directory}/classes/templates + res/templates + + + + + diff --git a/deploy/env/test/bin/main.sh b/deploy/env/test/bin/main.sh new file mode 100644 index 0000000000000000000000000000000000000000..d72299c9ff23e49381c34605da9854d6276e485a --- /dev/null +++ b/deploy/env/test/bin/main.sh @@ -0,0 +1,12 @@ +#!/bin/sh +. ~/.bash_profile +JAVA_HOME=/usr/local/java/jdk1.8.0_311 +CLASSPATH=./../res:./../lib/* +echo ------------------------------------------------------------------- +echo ------------------------------------------------------------------- +echo ------------------- start SpringBootDemo -------------------------- +PROVIDER=com.demo.SpringBootDemo +MEM_ARGS="-Xms128m -Xmx128m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m" +JAVA_OPTIONS="-Denv.name=SpringBootDemo -Dserver.port=$1" + +${JAVA_HOME}/bin/java ${MEM_ARGS} ${JAVA_OPTIONS} -classpath ${CLASSPATH} ${PROVIDER} diff --git a/deploy/env/test/bin/restartAll.sh b/deploy/env/test/bin/restartAll.sh new file mode 100644 index 0000000000000000000000000000000000000000..c2749535097f5df26d6ce5a00eaaeac959c339e8 --- /dev/null +++ b/deploy/env/test/bin/restartAll.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +#1.停止 +./stop.sh > /dev/null & + +#2.判断是否停止,停止则重新启动 +while : +do + PPROC=`ps -ef |grep $USER| grep "SpringBootDemo" | grep -v grep | awk '{print $2}'` + if [ -n "$PPROC" ] + then echo "Also, the application process is stopped and the startup process is waiting!" + else + echo "Ready to start the startup process!" + ./start.sh > /dev/null & + echo "The background has started the process, please wait for the completion of the program!" + break + fi + sleep 5 +done diff --git a/deploy/env/test/bin/start.sh b/deploy/env/test/bin/start.sh new file mode 100644 index 0000000000000000000000000000000000000000..31c7ccbfd2c93968a40bc241c106593ebbc5e7d9 --- /dev/null +++ b/deploy/env/test/bin/start.sh @@ -0,0 +1,5 @@ +#!/bin/sh +. ~/.bash_profile +#传递端口号到main.sh文件 +./main.sh 9100 >/dev/null & +echo start success \ No newline at end of file diff --git a/deploy/env/test/bin/stop.sh b/deploy/env/test/bin/stop.sh new file mode 100644 index 0000000000000000000000000000000000000000..0c707ca7d0116f4be9bf33967e06302280712bf2 --- /dev/null +++ b/deploy/env/test/bin/stop.sh @@ -0,0 +1,4 @@ +#!/bin/sh +#. ~/.bash_profile +ps -ef |grep $USER| grep "SpringBootDemo" | grep -v grep | awk '{print $2}'| xargs kill +echo 停止服务成功 \ No newline at end of file diff --git a/deploy/env/test/conf/application.yml b/deploy/env/test/conf/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..2c13102c6a78d42a3de28a93458d64f86cd64e57 --- /dev/null +++ b/deploy/env/test/conf/application.yml @@ -0,0 +1,98 @@ +server: + port: 9100 + servlet: + context-path: /bookManager + +spring: + main: + allow-bean-definition-overriding: true + mvc: + static-path-pattern: classpath:/static/** + pathmatch: + matching-strategy: ant_path_matcher + # 文件上传 + servlet: + multipart: + # 单个文件大小 + max-file-size: 1000MB + # 设置总上传的文件大小 + max-request-size: 2000MB + application: + name: spring-boot-demo + profiles: + active: dev + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.jdbc.Driver + url: jdbc:mysql://182.92.127.147/springbootdemo?useUnicode=true&characterEncoding=utf-8&useSSL=false + # 启用 P6spy 日志打印sql + # driver-class-name: com.p6spy.engine.spy.P6SpyDriver + # url: jdbc:p6spy:mysql://182.92.127.147/springbootdemo?useUnicode=true&characterEncoding=utf-8 + username: manager + password: xcw1017@ + druid: + # 初始化时建立物理连接的个数 + initial-size: 15 + # 连接池的最小空闲数量 + min-idle: 10 + # 连接池最大连接数量 + max-active: 50 + # 配置获取连接等待超时的时间 单位毫秒 + max-wait: 60000 + test-while-idle: true + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + time-between-eviction-runs-millis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + min-evictable-idle-time-millis: 300000 + #设置 FreeMarKar 模板引擎 + freemarker: + request-context-attribute: request # req 访问 + request-suffix: .ftl #模板后缀名 + content-type: text/html #文档类型 + charset: UTF-8 #页面编码格式 + cache: false #缓存配置 false 关掉 + template-loader-path: classpath:/templates/ #模板加载路径 按需配置 + enabled: true + settings: + number_format: '0.##' #数字格式化,无小数点 + redis: + host: 127.0.0.1 #10.1.137.204 + port: 6379 + timeout: 20000 + database: 2 + pool: + max-active: 300 #默认 8 + min-idle: 20 #默认 0 + max-idle: 100 #默认 8 + max-wait: -1 + #sentinel哨兵配置 + #sentinel: + # 哨兵集群的名称 主库 负责添加 从库负责查看 + # master: mymaster + # Redis的ip:Redis的端口,Redis1的ip:Redis1的端口,Redis2的ip:Redis2的端口 + # nodes: 127.0.0.1:26379,127.0.0.1:26380,127.0.0.1:26381 + #password: 123456 +mybatis-plus: + mapper-locations: classpath*:mapper/*/*Mapper.xml + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +knife4j: + enable: true # 开启增强配置 + production: false # true 开启生产环境api屏蔽,false 关闭api屏蔽 + setting: + language: zh-CN # Knife4j默认显示中文(zh-CN),如果开发者想直接显示英文(en-US),在通过该配置进行设置即可 + enable-debug: true #该属性是一个Boolean值,代表是否启用调试功能,默认值为true(代表开启调试),如果要禁用调试,该值设为false + basic: #对Knife4j提供的资源提供BasicHttp校验,保护文档 + enable: true #关闭BasicHttp功能 + username: admin # 用户名 + password: 123456 #密码 + +project: + api: com.demo.authority.controller + title: Spring-Boot-Demo 后台API +# +#logging: +# config: classpath:log4j2.xml +# level: +# io.swagger.models.parameters.AbstractSerializableParameter: error + diff --git a/deploy/env/test/conf/log4j2.xml b/deploy/env/test/conf/log4j2.xml new file mode 100644 index 0000000000000000000000000000000000000000..f4a36e4418269b0fef6cc3606ba9c199c132aaca --- /dev/null +++ b/deploy/env/test/conf/log4j2.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deploy/env/test/conf/spy.properties b/deploy/env/test/conf/spy.properties new file mode 100644 index 0000000000000000000000000000000000000000..4e5a908dd3089be7cb722bc6902223bcf146f96a --- /dev/null +++ b/deploy/env/test/conf/spy.properties @@ -0,0 +1,21 @@ +modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory +# 自定义日志打印 +logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger +#日志输出到控制台 +appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger +# 使用日志系统记录 sql +#appender=com.p6spy.engine.spy.appender.Slf4JLogger +# 设置 p6spy driver 代理 +deregisterdrivers=true +# 取消JDBC URL前缀 +useprefix=true +# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset. +excludecategories=info,debug,result,commit,resultset +# 日期格式 +dateformat=yyyy-MM-dd HH:mm:ss +# 实际驱动可多个 +#driverlist=org.h2.Driver +# 是否开启慢SQL记录 +outagedetection=true +# 慢SQL记录标准 2 秒 +outagedetectioninterval=2 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6b6105833210779c44dbc8db7ab6308a64f537fb..82dcc76d9b06116e19a51e5dfa9e653d5093dc27 100644 --- a/pom.xml +++ b/pom.xml @@ -12,8 +12,6 @@ 8 8 - 8 - 8 1.1.10 5.1.47 3.5.1 @@ -215,18 +213,122 @@ + + + + org.springframework.boot spring-boot-maven-plugin - 2.6.6 + 2.1.4.RELEASE repackage + + + ${maven.skipSpringBoot} + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.1.0 + + + make-assembly + package + + single + + + ${maven.skipAssembly} + + + ./assembly/assembly.xml + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.1 + + + ${maven.skipAssembly} + + com/** + org/** + mapper/** + META-INF/** + + + + + + + + + + + local + + + false + + true + + + + true + + + + + + test + + + true + + false + test + + + + + + prod + + true + false + prod + + + + +