Merge remote-tracking branch 'origin/master' into merge-temp
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关(轻量化,仅提供基础 Web 抽象) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
--- #################### 应用配置 ####################
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: iot-gateway-server
|
||||
profiles:
|
||||
active: prod
|
||||
|
||||
# Redis 配置
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
database: ${REDIS_DATABASE:0}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
timeout: ${REDIS_TIMEOUT:30000ms}
|
||||
|
||||
--- #################### 消息队列相关 ####################
|
||||
|
||||
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||
rocketmq:
|
||||
name-server: ${ROCKETMQ_NAMESRV_ADDR:127.0.0.1:9876}
|
||||
# Producer 配置项
|
||||
producer:
|
||||
group: ${spring.application.name}_PRODUCER
|
||||
|
||||
--- #################### IoT 网关相关配置 ####################
|
||||
|
||||
viewsh:
|
||||
iot:
|
||||
# 消息总线配置
|
||||
message-bus:
|
||||
type: ${IOT_MESSAGE_BUS_TYPE:redis}
|
||||
|
||||
# 网关配置
|
||||
gateway:
|
||||
# 设备 RPC 配置
|
||||
rpc:
|
||||
url: ${IOT_RPC_URL:http://127.0.0.1:48091}
|
||||
connect-timeout: ${IOT_RPC_CONNECT_TIMEOUT:30s}
|
||||
read-timeout: ${IOT_RPC_READ_TIMEOUT:30s}
|
||||
# 设备 Token 配置
|
||||
token:
|
||||
secret: ${IOT_TOKEN_SECRET:viewshIotGatewayTokenSecret123456789}
|
||||
expiration: ${IOT_TOKEN_EXPIRATION:7d}
|
||||
|
||||
# 协议配置
|
||||
protocol:
|
||||
# ====================================
|
||||
# 针对引入的 HTTP 组件的配置
|
||||
# ====================================
|
||||
http:
|
||||
enabled: ${IOT_HTTP_ENABLED:true}
|
||||
server-port: ${IOT_HTTP_PORT:8092}
|
||||
# ====================================
|
||||
# 针对引入的 EMQX 组件的配置
|
||||
# ====================================
|
||||
emqx:
|
||||
enabled: ${IOT_EMQX_ENABLED:false}
|
||||
http-port: ${IOT_EMQX_HTTP_PORT:8090}
|
||||
mqtt-host: ${IOT_EMQX_MQTT_HOST:127.0.0.1}
|
||||
mqtt-port: ${IOT_EMQX_MQTT_PORT:1883}
|
||||
mqtt-username: ${IOT_EMQX_MQTT_USERNAME:admin}
|
||||
mqtt-password: ${IOT_EMQX_MQTT_PASSWORD:public}
|
||||
mqtt-client-id: ${IOT_EMQX_MQTT_CLIENT_ID:iot-gateway-mqtt}
|
||||
mqtt-ssl: ${IOT_EMQX_MQTT_SSL:false}
|
||||
mqtt-topics:
|
||||
- "/sys/#"
|
||||
clean-session: true
|
||||
keep-alive-interval-seconds: 60
|
||||
max-inflight-queue: 10000
|
||||
connect-timeout-seconds: 10
|
||||
# 是否信任所有 SSL 证书 (默认: false)。警告:生产环境必须为 false!
|
||||
# 仅在开发环境或内网测试时,如果使用了自签名证书,可以临时设置为 true
|
||||
trust-all: ${IOT_EMQX_TRUST_ALL:false}
|
||||
# 遗嘱消息配置 (用于网关异常下线时通知其他系统)
|
||||
will:
|
||||
enabled: ${IOT_EMQX_WILL_ENABLED:true}
|
||||
topic: "gateway/status/${viewsh.iot.gateway.emqx.mqtt-client-id}"
|
||||
payload: "offline"
|
||||
qos: 1
|
||||
retain: true
|
||||
# 高级 SSL/TLS 配置 (当 trust-all: false 且 mqtt-ssl: true 时生效)
|
||||
ssl-options:
|
||||
key-store-path: ${IOT_EMQX_SSL_KEYSTORE_PATH:classpath:certs/client.jks}
|
||||
key-store-password: ${IOT_EMQX_SSL_KEYSTORE_PASSWORD:your-keystore-password}
|
||||
trust-store-path: ${IOT_EMQX_SSL_TRUSTSTORE_PATH:classpath:certs/trust.jks}
|
||||
trust-store-password: ${IOT_EMQX_SSL_TRUSTSTORE_PASSWORD:your-truststore-password}
|
||||
# ====================================
|
||||
# 针对引入的 TCP 组件的配置
|
||||
# ====================================
|
||||
tcp:
|
||||
enabled: ${IOT_TCP_ENABLED:false}
|
||||
port: ${IOT_TCP_PORT:8091}
|
||||
keep-alive-timeout-ms: ${IOT_TCP_KEEPALIVE_TIMEOUT:30000}
|
||||
max-connections: ${IOT_TCP_MAX_CONNECTIONS:1000}
|
||||
ssl-enabled: ${IOT_TCP_SSL_ENABLED:false}
|
||||
ssl-cert-path: ${IOT_TCP_SSL_CERT_PATH:classpath:certs/client.jks}
|
||||
ssl-key-path: ${IOT_TCP_SSL_KEY_PATH:classpath:certs/client.jks}
|
||||
# ====================================
|
||||
# 针对引入的 MQTT 组件的配置
|
||||
# ====================================
|
||||
mqtt:
|
||||
enabled: ${IOT_MQTT_ENABLED:true}
|
||||
port: ${IOT_MQTT_PORT:1883}
|
||||
max-message-size: ${IOT_MQTT_MAX_MESSAGE_SIZE:8192}
|
||||
connect-timeout-seconds: ${IOT_MQTT_CONNECT_TIMEOUT:60}
|
||||
ssl-enabled: ${IOT_MQTT_SSL_ENABLED:false}
|
||||
|
||||
--- #################### 日志相关配置 ####################
|
||||
|
||||
# 基础日志配置
|
||||
logging:
|
||||
file:
|
||||
name: ${LOG_FILE_PATH:/app/logs}/${spring.application.name}.log
|
||||
level:
|
||||
# 应用基础日志级别
|
||||
com.viewsh.module.iot.gateway: ${LOG_LEVEL_IOT_GATEWAY:INFO}
|
||||
org.springframework.boot: INFO
|
||||
# RocketMQ 日志
|
||||
org.apache.rocketmq: WARN
|
||||
# MQTT 客户端日志
|
||||
# io.vertx.mqtt: DEBUG
|
||||
# 生产环境日志
|
||||
com.viewsh.module.iot.gateway.protocol.emqx: ${LOG_LEVEL_EMQX:INFO}
|
||||
com.viewsh.module.iot.gateway.protocol.http: ${LOG_LEVEL_HTTP:INFO}
|
||||
com.viewsh.module.iot.gateway.protocol.mqtt: ${LOG_LEVEL_MQTT:INFO}
|
||||
# 根日志级别
|
||||
root: INFO
|
||||
|
||||
debug: false
|
||||
|
||||
@@ -4,6 +4,11 @@ spring:
|
||||
profiles:
|
||||
active: local # 默认激活本地开发环境
|
||||
|
||||
config:
|
||||
import:
|
||||
- optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
|
||||
# - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
|
||||
|
||||
# Redis 配置
|
||||
data:
|
||||
redis:
|
||||
@@ -12,7 +17,8 @@ spring:
|
||||
database: ${REDIS_DATABASE:0} # Redis 数据库索引
|
||||
# password: ${REDIS_PASSWORD:9kHXcZ1ojFsD} # Redis 密码
|
||||
timeout: 30000ms # 连接超时时间
|
||||
|
||||
server:
|
||||
port: 48095
|
||||
--- #################### 消息队列相关 ####################
|
||||
|
||||
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||
|
||||
@@ -118,6 +118,12 @@
|
||||
<artifactId>viewsh-spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 监控相关 -->
|
||||
<dependency>
|
||||
<groupId>com.viewsh</groupId>
|
||||
<artifactId>viewsh-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>com.viewsh</groupId>
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
--- #################### 注册中心 + 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: ${NACOS_ADDR:127.0.0.1:8848}
|
||||
username: ${NACOS_USERNAME:nacos}
|
||||
password: ${NACOS_PASSWORD:nacos}
|
||||
discovery:
|
||||
namespace: ${NACOS_DISCOVERY_NAMESPACE:prod}
|
||||
group: DEFAULT_GROUP
|
||||
metadata:
|
||||
version: 1.0.0
|
||||
config:
|
||||
namespace: ${NACOS_CONFIG_NAMESPACE:prod}
|
||||
group: DEFAULT_GROUP
|
||||
file-extension: yaml
|
||||
refresh-enabled: true
|
||||
|
||||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
login-username: ${DRUID_USERNAME:admin}
|
||||
login-password: ${DRUID_PASSWORD:admin}
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic:
|
||||
druid:
|
||||
initial-size: 5
|
||||
min-idle: 10
|
||||
max-active: 20
|
||||
max-wait: 60000
|
||||
time-between-eviction-runs-millis: 60000
|
||||
min-evictable-idle-time-millis: 600000
|
||||
max-evictable-idle-time-millis: 1800000
|
||||
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: 20
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://${MYSQL_HOST:127.0.0.1}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:aiot_platform}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true
|
||||
username: ${MYSQL_USER:root}
|
||||
password: ${MYSQL_PASSWORD:}
|
||||
slave:
|
||||
lazy: true
|
||||
url: jdbc:mysql://${MYSQL_SLAVE_HOST:${MYSQL_HOST:127.0.0.1}}:${MYSQL_SLAVE_PORT:${MYSQL_PORT:3306}}/${MYSQL_DATABASE:aiot_platform}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true
|
||||
username: ${MYSQL_SLAVE_USER:${MYSQL_USER:root}}
|
||||
password: ${MYSQL_SLAVE_PASSWORD:${MYSQL_PASSWORD:}}
|
||||
tdengine:
|
||||
url: jdbc:TAOS-RS://${TDENGINE_HOST:172.17.16.14}:${TDENGINE_PORT:6041}/aiot_platform
|
||||
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
|
||||
username: ${TDENGINE_USERNAME:root}
|
||||
password: ${TDENGINE_PASSWORD:taosdata}
|
||||
druid:
|
||||
validation-query: SELECT SERVER_STATUS()
|
||||
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
database: ${REDIS_DATABASE:0}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
timeout: 5000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1ms
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
rocketmq:
|
||||
name-server: ${ROCKETMQ_NAMESRV_ADDR:127.0.0.1:9876}
|
||||
|
||||
spring:
|
||||
# 禁用 RabbitMQ 自动配置(如果不需要 RabbitMQ,避免启动时连接失败)
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration
|
||||
# RabbitMQ 配置(已禁用自动配置,仅保留配置项供业务代码使用)
|
||||
# rabbitmq:
|
||||
# host: ${RABBITMQ_HOST:127.0.0.1}
|
||||
# port: ${RABBITMQ_PORT:5672}
|
||||
# username: ${RABBITMQ_USERNAME:guest}
|
||||
# password: ${RABBITMQ_PASSWORD:guest}
|
||||
kafka:
|
||||
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:127.0.0.1:9092}
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: ${XXL_JOB_ADMIN_ADDRESSES:http://172.17.16.14:19090/xxl-job-admin}
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
lock4j:
|
||||
acquire-timeout: 3000
|
||||
expire: 30000
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator
|
||||
exposure:
|
||||
include: '*'
|
||||
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP
|
||||
username: ${SPRING_BOOT_ADMIN_USERNAME:admin}
|
||||
password: ${SPRING_BOOT_ADMIN_PASSWORD:admin}
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
com.viewsh: ${LOG_LEVEL:INFO}
|
||||
com.viewsh.module.iot.dal.mysql: debug
|
||||
com.viewsh.module.iot.dal.mysql.sms.SmsChannelMapper: INFO
|
||||
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR
|
||||
file:
|
||||
name: ${LOG_FILE_PATH:/app/logs}/${spring.application.name}.log
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
viewsh:
|
||||
demo: false
|
||||
env:
|
||||
tag: ${HOSTNAME:prod}
|
||||
captcha:
|
||||
enable: true
|
||||
security:
|
||||
mock-enable: false
|
||||
Reference in New Issue
Block a user