From 28550efb561f709e7763dd3ca9bd9540aa2710c9 Mon Sep 17 00:00:00 2001 From: sunshihuan <13733918655@163.com> Date: Mon, 27 Mar 2023 17:32:06 +0800 Subject: [PATCH] fix nacosConfig --- .../DEFAULT_GROUP/application.yml | 59 +++++++++ .../DEFAULT_GROUP/thinglinks-auth.yml | 3 + .../DEFAULT_GROUP/thinglinks-gateway.yml | 113 +++++++++++++++++ .../thinglinks-modules-broker.yml | 117 ++++++++++++++++++ .../DEFAULT_GROUP/thinglinks-modules-file.yml | 23 ++++ .../DEFAULT_GROUP/thinglinks-modules-gen.yml | 27 ++++ .../DEFAULT_GROUP/thinglinks-modules-job.yml | 16 +++ .../DEFAULT_GROUP/thinglinks-modules-link.yml | 16 +++ .../thinglinks-modules-protocolAnalysis.yml | 9 ++ .../DEFAULT_GROUP/thinglinks-modules-rule.yml | 16 +++ .../thinglinks-modules-system.yml | 16 +++ .../thinglinks-modules-tdengine.yml | 84 +++++++++++++ .../thinglinks-visual-monitor.yml | 14 +++ 13 files changed, 513 insertions(+) create mode 100755 doc/nacos-config/DEFAULT_GROUP/application.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-auth.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-gateway.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-broker.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-file.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-gen.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-job.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-link.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-protocolAnalysis.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-rule.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-system.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-tdengine.yml create mode 100755 doc/nacos-config/DEFAULT_GROUP/thinglinks-visual-monitor.yml diff --git a/doc/nacos-config/DEFAULT_GROUP/application.yml b/doc/nacos-config/DEFAULT_GROUP/application.yml new file mode 100755 index 00000000..3ecaf22e --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/application.yml @@ -0,0 +1,59 @@ +spring: + main: + allow-circular-references: true + allow-bean-definition-overriding: true + autoconfigure: + exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure + mvc: + pathmatch: + matching-strategy: ant_path_matcher + +#请求处理的超时时间 +ribbon: + ReadTimeout: 10000 + ConnectTimeout: 10000 + +# feign 配置 +feign: + hystrix: + enabled: true + sentinel: + enabled: true + okhttp: + enabled: true + httpclient: + enabled: false + client: + config: + default: + connectTimeout: 10000 + readTimeout: 10000 + compression: + request: + enabled: true + response: + enabled: true + +# 暴露监控端点 +management: + metrics: + export: + influx: + enabled: false + endpoints: + web: + exposure: + include: '*' +#线程池总线资源配置 +threadBus: + pool: + #核心线程数(默认线程数) + core-pool-size: 8 + #最大线程数 + max-pool-size: 16 + #允许线程空闲时间(单位:默认为秒) + keep-alive-time: 60 + #缓冲队列大小 + queue-capacity: 1000 + #线程池名前缀 + thread-name-prefix: thinglinksAsync- diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-auth.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-auth.yml new file mode 100755 index 00000000..abbadf4f --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-auth.yml @@ -0,0 +1,3 @@ +# Tomcat +server: + port: 19200 \ No newline at end of file diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-gateway.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-gateway.yml new file mode 100755 index 00000000..d575afc9 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-gateway.yml @@ -0,0 +1,113 @@ +# Tomcat +server: + port: 19100 + +spring: + cloud: + gateway: + discovery: + locator: + lowerCaseServiceId: true + enabled: true + routes: + # 认证中心 + - id: thinglinks-auth + uri: lb://thinglinks-auth + predicates: + - Path=/auth/** + filters: + # 验证码处理 + - CacheRequestFilter + - ValidateCodeFilter + - StripPrefix=1 + # 代码生成 + - id: thinglinks-modules-gen + uri: lb://thinglinks-modules-gen + predicates: + - Path=/code/** + filters: + - StripPrefix=1 + # 定时任务 + - id: thinglinks-modules-job + uri: lb://thinglinks-modules-job + predicates: + - Path=/schedule/** + filters: + - StripPrefix=1 + # 系统模块 + - id: thinglinks-modules-system + uri: lb://thinglinks-modules-system + predicates: + - Path=/system/** + filters: + - StripPrefix=1 + # 文件服务 + - id: thinglinks-modules-file + uri: lb://thinglinks-modules-file + predicates: + - Path=/file/** + filters: + - StripPrefix=1 + # TDengine服务 + - id: thinglinks-modules-tdengine + uri: lb://thinglinks-modules-tdengine + predicates: + - Path=/tdengine/** + filters: + - StripPrefix=1 + # Link服务 + - id: thinglinks-modules-link + uri: lb://thinglinks-modules-link + predicates: + - Path=/link/** + filters: + - StripPrefix=1 + # Broker服务 + - id: thinglinks-modules-broker + uri: lb://thinglinks-modules-broker + predicates: + - Path=/broker/** + filters: + - StripPrefix=1 + - RemoveRequestHeader=Sec-WebSocket-Protocol #移除请求头 + # ProtocolAnalysis服务 + - id: thinglinks-modules-protocolAnalysis + uri: lb://thinglinks-modules-protocolAnalysis + predicates: + - Path=/protocolAnalysis/** + filters: + - StripPrefix=1 + # rule服务 + - id: thinglinks-modules-rule + uri: lb://thinglinks-modules-rule + predicates: + - Path=/rule/** + filters: + - StripPrefix=1 + +# 安全配置 +security: + # 验证码 + captcha: + enabled: true + type: char + # 防止XSS攻击 + xss: + enabled: true + excludeUrls: + - /system/notice + # 不校验白名单 + ignore: + whites: + - /auth/logout + - /auth/login + - /auth/register + - /*/v2/api-docs + - /csrf + #MQTT消息推送接口 + - /broker/publish/sendMessage + #Broker WebSocket推送日志 + - /broker/websocket/logging + #客户端身份认证接口 + - /link/device/clientAuthentication + - /tdengine/** diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-broker.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-broker.yml new file mode 100755 index 00000000..70ac3d60 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-broker.yml @@ -0,0 +1,117 @@ +# Tomcat +server: + port: 19306 + +#smqtt配置文件V2.0 +smqtt: + logLevel: INFO # 系统日志 + tcp: # tcp配置 + port: 11883 # mqtt端口号 + notKickSecond: 30 # KICK互踢模式生效, 单位秒, 指定时间内客户端不互踢, 避免客户端自动连接持续互踢 + wiretap: false # 二进制日志 前提是 smqtt.logLevel = DEBUG + bossThreadSize: 1 # boss线程 默认=1 + workThreadSize: 9 # work线程 默认=cpu核心数+1 + businessThreadSize: 8 # 业务线程数 默认=cpu核心数 + businessQueueSize: 100000 #业务队列 默认=100000 + messageMaxSize: 4194304 # 接收消息的最大限制 默认4194304(4M) + lowWaterMark: 4000000 # 不建议配置 默认 32768 + highWaterMark: 80000000 # 不建议配置 默认 65536 + # globalReadWriteSize: 10000000,100000000 全局读写大小限制 + # channelReadWriteSize: 10000000,100000000 单个channel读写大小限制 + options: # netty option设置 + SO_BACKLOG: 2000 + childOptions: #netty child option设置 + SO_REUSEADDR: true + ssl: # ssl配置 + enable: false # 开关 + key: classpath:ssl/server.key # 指定ssl文件 默认系统生成 + crt: classpath:ssl/server.crt # 指定ssl文件 默认系统生成 + ca: classpath:ssl/server.ca # ca证书 双向加密配置 + acl: + aclPolicy: JDBC # NONE or FILE or JDBC + filePath: # FILE时配置filePath + jdbcAclConfig: + driver: com.mysql.jdbc.Driver + url: ${spring.datasource.dynamic.datasource.master.url} + username: ${spring.datasource.dynamic.datasource.master.username} + password: ${spring.datasource.dynamic.datasource.master.password} + http: # http相关配置 端口固定60000 + enable: true # 开关 + accessLog: false # http访问日志 + ssl: # ssl配置 + enable: false + admin: # Broker后台管理配置 + enable: true # 开关 + username: thinglinks # 访问用户名 + password: thinglinks # 访问密码 + auth: + http: #设备鉴权模式(请求方式固定 POST body 格式为: {"clientIdentifier":"","username":"","password":""} 返回状态码 200 即可 如果检验失败返回400) + host: 127.0.0.1 #网关服务器IP + port: 19100 #网关服务端口 + path: /link/device/clientAuthentication + params: {"deviceStatus":"ENABLE","protocolType":"MQTT"} + ws: # websocket配置 + enable: true # 开关 + port: 18999 # 端口 + path: /mqtt # ws 的访问path mqtt.js请设置此选项 + cluster: # 集群配置 + #本地IP,多网卡时候指定 + localAddress: 127.0.0.1 + #集群IP集合 + addresses: ["127.0.0.1"] + #集群持久化目录,默认启动目录 + #workDirectory: /soft/dir + meter: + meterType: PROMETHEUS # INFLUXDB , PROMETHEUS + rules: + - ruleName: ROCKET_MQ + chain: + - ruleType: PREDICATE + script: $.event.equals("ping") + - ruleType: ROCKET_MQ + script: "{'event':'ping','clientId':clientId,'messageId':messageId,'time':time}" + - ruleName: ROCKET_MQ + chain: + - ruleType: PREDICATE + script: $.event.equals("connect") + - ruleType: ROCKET_MQ + script: "{'event':'connect','clientId':clientId,'auth':auth,'clientAddress':clientAddress,'keepalive':keepalive,'nodeIp':nodeIp,'version':version,'time':time,'will':will}" + - ruleName: ROCKET_MQ + chain: + - ruleType: PREDICATE + script: $.event.equals("publish") + - ruleType: ROCKET_MQ + script: "{'event':'publish','topic':topic,'body':body,'qos':qos,'clientId':clientId,'messageId':messageId,'time':time}" + - ruleName: ROCKET_MQ + chain: + - ruleType: PREDICATE + script: $.event.equals("disconnect") + - ruleType: ROCKET_MQ + script: "{'event':'disconnect','clientId':clientId,'time':time}" + - ruleName: ROCKET_MQ + chain: + - ruleType: PREDICATE + script: $.event.equals("clone") + - ruleType: ROCKET_MQ + script: "{'event':'disconnect','clientId':clientId,'time':time}" + - ruleName: ROCKET_MQ + chain: + - ruleType: PREDICATE + script: $.event.equals("subscribe") + - ruleType: ROCKET_MQ + script: "{'event':'subscribe','clientId':clientId,'subscribeTopics':subscribeTopics,'time':time}" + - ruleName: ROCKET_MQ + chain: + - ruleType: PREDICATE + script: $.event.equals("unsubscribe") + - ruleType: ROCKET_MQ + script: "{'event':'unsubscribe','clientId':clientId,'topics':topics,'time':time}" + sources: # 配置数据源sources + - source: ROCKET_MQ # rocketmq配置 + sourceName: rocket_mq + sourceAttributes: + topic: thinglinks-link-mqttMsg + tags: thinglinks + namesrvAddr: 127.0.0.1:19876 + instanceName: broker-a + producerGroup: thinglinks \ No newline at end of file diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-file.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-file.yml new file mode 100755 index 00000000..b9343f98 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-file.yml @@ -0,0 +1,23 @@ +# Tomcat +server: + port: 19300 + +# 本地文件上传 +file: + domain: http://127.0.0.1:19300 + path: /Users/xiaonan/Documents/data/uploadPath + prefix: /statics + +# FastDFS配置 +fdfs: + domain: http://8.129.231.12 + soTimeout: 3000 + connectTimeout: 2000 + trackerList: 8.129.231.12:22122 + +# Minio配置 +minio: + url: http://127.0.0.1:16001 + accessKey: minioadmin + secretKey: minioadmin + bucketName: thinglinks \ No newline at end of file diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-gen.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-gen.yml new file mode 100755 index 00000000..f34cbfc7 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-gen.yml @@ -0,0 +1,27 @@ +# Tomcat +server: + port: 19301 + +# mybatis配置 +mybatis: + # 搜索指定包别名 + typeAliasesPackage: com.mqttsnet.thinglinks.gen.domain + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath:mapper/**/*.xml + +# swagger配置 +swagger: + title: 代码生成接口文档 + license: Powered By thinglinks + licenseUrl: https://doc.thinglinks.mqttsnet.com + +# 代码生成 +gen: + # 作者 + author: thinglinks + # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool + packageName: com.mqttsnet.thinglinks.link + # 自动去除表前缀,默认是false + autoRemovePre: false + # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) + tablePrefix: thinglinks_ diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-job.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-job.yml new file mode 100755 index 00000000..f2849120 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-job.yml @@ -0,0 +1,16 @@ +# Tomcat +server: + port: 19302 + +# mybatis配置 +mybatis: + # 搜索指定包别名 + typeAliasesPackage: com.mqttsnet.thinglinks.job + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath:mapper/**/*.xml + +# swagger配置 +swagger: + title: 定时任务接口文档 + license: Powered By thinglinks + licenseUrl: https://doc.thinglinks.mqttsnet.com diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-link.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-link.yml new file mode 100755 index 00000000..abccaa25 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-link.yml @@ -0,0 +1,16 @@ +# Tomcat +server: + port: 19305 + +# mybatis配置 +mybatis: + # 搜索指定包别名 + typeAliasesPackage: com.mqttsnet.thinglinks.link + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath:mapper/**/*.xml + +# swagger配置 +swagger: + title: Link模块接口文档 + license: Powered By thinglinks + licenseUrl: https://showdoc.thinglinks.mqttsnet.com \ No newline at end of file diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-protocolAnalysis.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-protocolAnalysis.yml new file mode 100755 index 00000000..2ba22f15 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-protocolAnalysis.yml @@ -0,0 +1,9 @@ +# Tomcat +server: + port: 19307 + +protocol: + tcp-ip: + port: 18901 + udp-ip: + port: 18902 \ No newline at end of file diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-rule.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-rule.yml new file mode 100755 index 00000000..b0adda82 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-rule.yml @@ -0,0 +1,16 @@ +# Tomcat +server: + port: 19308 + +# mybatis配置 +mybatis: + # 搜索指定包别名 + typeAliasesPackage: com.mqttsnet.thinglinks.rule + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath:mapper/**/*.xml + +# swagger配置 +swagger: + title: Link模块接口文档 + license: Powered By thinglinks + licenseUrl: https://showdoc.thinglinks.mqttsnet.com \ No newline at end of file diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-system.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-system.yml new file mode 100755 index 00000000..5452c0d3 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-system.yml @@ -0,0 +1,16 @@ +# Tomcat +server: + port: 19303 + +# mybatis配置 +mybatis: + # 搜索指定包别名 + typeAliasesPackage: com.mqttsnet.thinglinks.system + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath:mapper/**/*.xml + +# swagger配置 +swagger: + title: 系统模块接口文档 + license: Powered By thinglinks + licenseUrl: https://doc.thinglinks.mqttsnet.com \ No newline at end of file diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-tdengine.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-tdengine.yml new file mode 100755 index 00000000..6f1c49a9 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-modules-tdengine.yml @@ -0,0 +1,84 @@ +# Tomcat +server: + port: 19304 + +spring: + datasource: + druid: + stat-view-servlet: + enabled: true + loginUsername: admin + loginPassword: 123456 + dynamic: + # 开启seata代理,开启后默认每个数据源都代理,如果某个不需要代理可单独关闭 + seata: false + druid: + initial-size: 5 + min-idle: 5 + maxActive: 20 + maxWait: 60000 + timeBetweenEvictionRunsMillis: 60000 + minEvictableIdleTimeMillis: 300000 + validationQuery: SELECT SERVER_STATUS(); + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + poolPreparedStatements: true + maxPoolPreparedStatementPerConnectionSize: 20 + filters: stat,slf4j + connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 + datasource: + # 主库数据源 + master: + driver-class-name: com.taosdata.jdbc.rs.RestfulDriver + url: jdbc:TAOS-RS://127.0.0.1:6041/${spring.datasource.dynamic.datasource.master.dbName}?user=${spring.datasource.dynamic.datasource.master.username}&password=${spring.datasource.dynamic.datasource.master.password}&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 + dbName: thinglinks + username: root + password: taosdata + # 从库数据源 + # slave: + # username: + # password: + # url: + # driver-class-name: + aop: + auto: true + proxy-target-class: true +mybatis: + mapper-locations: classpath:mapper/*.xml + +# seata配置 +seata: + # 默认关闭,如需启用spring.datasource.dynami.seata需要同时开启 + enabled: false + # Seata 应用编号,默认为 ${spring.application.name} + application-id: ${spring.application.name} + # Seata 事务组编号,用于 TC 集群名 + tx-service-group: ${spring.application.name}-group + # 关闭自动代理 + enable-auto-data-source-proxy: false + # 服务配置项 + service: + # 虚拟组和分组的映射 + vgroup-mapping: + ruoyi-system-group: default + config: + type: nacos + nacos: + serverAddr: 127.0.0.1:18848 + group: SEATA_GROUP + namespace: 291b5c47-d2d3-4d42-b338-e23c59d32b30 + registry: + type: nacos + nacos: + application: seata-server + server-addr: 127.0.0.1:18848 + namespace: 291b5c47-d2d3-4d42-b338-e23c59d32b30 + +logging: + level: + com: + taosdata: + jdbc: + springbootdemo: + dao: debug \ No newline at end of file diff --git a/doc/nacos-config/DEFAULT_GROUP/thinglinks-visual-monitor.yml b/doc/nacos-config/DEFAULT_GROUP/thinglinks-visual-monitor.yml new file mode 100755 index 00000000..a2986ee8 --- /dev/null +++ b/doc/nacos-config/DEFAULT_GROUP/thinglinks-visual-monitor.yml @@ -0,0 +1,14 @@ +# Tomcat +server: + port: 19400 + +# spring配置 +spring: + security: + user: + name: thinglinks + password: 123456 + boot: + admin: + ui: + title: thinglinks服务状态监控