From 36003db15081cc9bed5ea3227eebc8a19e1d518b Mon Sep 17 00:00:00 2001 From: WenG <450292408@qq.com> Date: Sat, 5 Mar 2022 22:48:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8A=E7=BA=BF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 + pom.xml | 2 +- src/main/resources/application-dev.yml | 10 +- src/main/resources/application-prod.yml | 164 ++++++++++++++++++ src/main/resources/mybatis/mybatis-config.xml | 4 + 5 files changed, 182 insertions(+), 6 deletions(-) create mode 100644 Dockerfile create mode 100644 src/main/resources/application-prod.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..02a088f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM openjdk:8u292-jre-buster +ARG JAR_FILE=/target/*.jar +COPY ${JAR_FILE} system-duty.jar +ENTRYPOINT ["java","-jar","-Dspring.profiles.active=prod","/system-duty.jar"] + +# 时区问题 +RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone + diff --git a/pom.xml b/pom.xml index 4c041fd..165406f 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ cn.com.tenlion system-duty - 0.0.1-SNAPSHOT + 1.0.0-SNAPSHOT system-duty system-duty diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 0637a31..fb5ee2f 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -28,7 +28,7 @@ spring: max-request-size: 1GB datasource: druid: - url: jdbc:mysql://127.0.0.1:3306/db_smart_city_duty?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true + url: jdbc:mysql://192.168.0.103:3306/db_smart_city_duty?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true db-type: mysql driver-class-name: com.mysql.cj.jdbc.Driver username: root @@ -55,10 +55,10 @@ spring: use-global-data-source-stat: true data: mongodb: - uri: mongodb://smartcity:smartcity@127.0.0.1:27017/smartcity + uri: mongodb://smartcity:smartcity@192.168.0.103:27017/smartcity redis: database: 6 - host: 127.0.0.1 + host: 192.168.0.103 port: 6379 password: 666 timeout: 3000ms @@ -69,7 +69,7 @@ spring: max-idle: 8 min-idle: 0 kafka: - bootstrap-servers: localhost:9092 + bootstrap-servers: 192.168.0.103:9092 producer: # 写入失败时,重试次数。当leader节点失效,一个repli节点会替代成为leader节点,此时可能出现写入失败, # 当retris为0时,produce不会重复。retirs重发,此时repli节点完全成为leader节点,不会产生消息丢失。 @@ -145,7 +145,7 @@ file: use-min-io: true # 与use-min-io配套使用 min-io: - endpoint: http://127.0.0.1:9900 + endpoint: http://192.168.0.103:9900 access-key: smartcity secret-key: smartcity diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml new file mode 100644 index 0000000..7a8ca6f --- /dev/null +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,164 @@ +server: + port: 7013 + url: http://www.wlcbsyzl.cn/duty + system-title: 考核上报系统 + system-sub-title: 考核上报系统 + nav-page: http://www.wlcbsyzl.cn/usercenter +# default-index-page: route/system/index + default-home-page: route/default-page/home + servlet: + context-path: /duty + +spring: + login-url: /oauth/login + login-failure: /oauth/login?error + login-process: /userlogin + assets-matchers: /assets/** + thymeleaf: + prefix: classpath:/templates/ + suffix: .html + mode: HTML5 + encoding: UTF-8 + cache: false + main: + allow-bean-definition-overriding: true + servlet: + multipart: + max-file-size: 1GB + max-request-size: 1GB + datasource: + druid: + url: jdbc:mysql://192.168.158.18:3306/db_smart_city_duty?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true + db-type: mysql + driver-class-name: com.mysql.cj.jdbc.Driver + username: tsroot + password: TSkj@0471.TSROOT + initial-size: 2 + min-idle: 2 + max-active: 5 + max-wait: 60000 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 10 + filter: + commons-log: + connection-logger-name: stat,wall,log4j + stat: + log-slow-sql: true + slow-sql-millis: 2000 + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + use-global-data-source-stat: true + data: + mongodb: + uri: mongodb://smartcity:smartcity@192.168.158.20:6011/smartcity + redis: + database: 6 + host: 192.168.158.20 + port: 6012 + password: TSkj@0471.REDIS + timeout: 3000ms + jedis: + pool: + max-active: 8 + max-wait: 1ms + max-idle: 8 + min-idle: 0 + kafka: + bootstrap-servers: 192.168.158.14:9092 + producer: + # 写入失败时,重试次数。当leader节点失效,一个repli节点会替代成为leader节点,此时可能出现写入失败, + # 当retris为0时,produce不会重复。retirs重发,此时repli节点完全成为leader节点,不会产生消息丢失。 + retries: 0 + #procedure要求leader在考虑完成请求之前收到的确认数,用于控制发送记录在服务端的持久化,其值可以为如下: + #acks = 0 如果设置为零,则生产者将不会等待来自服务器的任何确认,该记录将立即添加到套接字缓冲区并视为已发送。在这种情况下,无法保证服务器已收到记录,并且重试配置将不会生效(因为客户端通常不会知道任何故障),为每条记录返回的偏移量始终设置为-1。 + #acks = 1 这意味着leader会将记录写入其本地日志,但无需等待所有副本服务器的完全确认即可做出回应,在这种情况下,如果leader在确认记录后立即失败,但在将数据复制到所有的副本服务器之前,则记录将会丢失。 + #acks = all 这意味着leader将等待完整的同步副本集以确认记录,这保证了只要至少一个同步副本服务器仍然存活,记录就不会丢失,这是最强有力的保证,这相当于acks = -1的设置。 + #可以设置的值为:all, -1, 0, 1 + acks: 1 + consumer: + group-id: SmartCity + # smallest和largest才有效,如果smallest重新0开始读取,如果是largest从logfile的offset读取。一般情况下我们都是设置smallest + auto-offset-reset: earliest + # 设置自动提交offset + enable-auto-commit: true + # 如果'enable.auto.commit'为true,则消费者偏移自动提交给Kafka的频率(以毫秒为单位),默认值为5000。 + auto-commit-interval: 100 + max-poll-records: 5 + +# 安全 +security: + oauth2: + oauth-server: http://www.wlcbsyzl.cn/usercenter + oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url} + client: + client-id: 09b8dfabd94f4febbf513ea05a05a612 + client-secret: Y1NsL3ZEMWJtOWluTGVzSHFqMm5zbU8wNzBmNGJvc3luNEI5UjVVZHMzamxIdG9KZmEyTjJIRnI0dG1McEdEVA== + user-authorization-uri: ${security.oauth2.oauth-server}/oauth2_client/authorize + access-token-uri: http://10.25.242.183/usercenter/oauth2_client/token + grant-type: authorization_code + resource: + jwt: + key-uri: http://10.25.242.183/usercenter/oauth2_client/token_key + token-info-uri: http://10.25.242.183/usercenter/oauth2_client/check_token + user-info-uri: http://10.25.242.183/usercenter/user + authorization: + check-token-access: http://10.25.242.183/usercenter/oauth2_client/token_key + +api-path: + user-center: http://10.25.242.183/usercenter + +# 数据库 +mybatis: + config-location: classpath:mybatis/mybatis-config.xml + mapper-locations: classpath*:mybatis/mapper/**/*.xml + +# 文档 +swagger: + base-package-list: ink.wgink,cn.com.tenlion + +# 访问控制 +access-control: + role-permission: false + +# 文件 +file: + # 文件的保存路径 + upload-path: /project/UploadFiles/ + # 图片类型 + image-types: png,jpg,jpeg,gif,blob + # 视频类型 + video-types: mp4,rmvb + # 音频类型 + audio-types: mp3,wmv,amr + # 文件类型 + file-types: doc,docx,xls,xlsx,ppt,pptx,txt,zip,rar,apk,pdf + # 同时上传最大支持数 + max-file-count: 6 + # 图片输出压缩质量,大于0,默认0.4 + image-output-quality: 0.4 + # 启用minIo + use-min-io: true + # 与use-min-io配套使用 + min-io: + endpoint: http://192.168.158.17:9001 + access-key: smartcity + secret-key: smartcity + +# 日志 +logging: + file: + # 日志文件的路径,不设置不生成日志文件 + name: /project/logs/duty-logs.log + level: + root: error + ink.wgink: debug + cn.com.tenlion: debug + +system-role: + examiner: f085a0bf-ee57-42f4-bfbb-bc06ce480ffc + reporter: 674f930d-5b40-46fe-befa-6127ca556b97 diff --git a/src/main/resources/mybatis/mybatis-config.xml b/src/main/resources/mybatis/mybatis-config.xml index c82cf27..07503f1 100644 --- a/src/main/resources/mybatis/mybatis-config.xml +++ b/src/main/resources/mybatis/mybatis-config.xml @@ -1,6 +1,10 @@ + + + +