forked from jetlinks/jetlinks-community
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.yml
More file actions
318 lines (315 loc) · 11.4 KB
/
Copy pathapplication.yml
File metadata and controls
318 lines (315 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
server:
port: 8848
spring:
profiles:
active: default,dev,local
application:
name: jetlinks-platform
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: Asia/Shanghai
serialization:
WRITE_DATES_AS_TIMESTAMPS: true
default-property-inclusion: non_null
codec:
max-in-memory-size: 100MB
web:
resources:
static-locations: file:./static/,/,classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/, classpath:/public/
data:
redis:
host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT}
timeout: 20s
database: ${REDIS_DATABASE}
password: ${REDIS_PASSWORD:""}
r2dbc:
# 需要手动创建数据库,启动会自动创建表,修改了配置easyorm相关配置也要修改
url: r2dbc:postgresql://${DB_HOST:127.0.0.1}:${DB_PORT:5432}/${DB_DATABASE:jetlinks}
# 如果需要切换为mysql,请同时禁用timescaledb.enabled=false或者单独配置timescaledb.r2dbc.url
# 如果需要使用elasticsearch,请勾选es7x profile或者手动引入es依赖,具体在pom.xml搜索es7x.并配置elasticsearch相关配置
# 数据库说明: https://hanta.yuque.com/px7kg1/dev/tw77qae6b08bcdfh
# 注意:切换了数据库easyorm相关配置也要修改
# url: r2dbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_DATABASE}?ssl=false&serverZoneId=Asia/Shanghai
username: ${DB_USERNAME:postgres}
password: ${DB_PASSWORD:jetlinks}
pool:
max-size: 128
max-idle-time: 2m # 值不能大于mysql server的wait_timeout配置
max-life-time: 10m
max-acquire-time: 30s
reactor:
debug-agent:
enabled: false
# 引入elasticsearch相关模块后使用elasticsearch来存储设备、时序、日志等数据
elasticsearch:
uris: ${ES_URIS:127.0.0.1:9200}
socket-timeout: 10s
connection-timeout: 15s
username: ${ES_USERNAME:""}
password: ${ES_PASSWORD:""}
easyorm:
default-schema: ${DB_SCHEMA:public} # 数据库默认的schema,mysql时则为数据库名.(注意大小写,请勿使用-等特殊字符)
dialect: ${DB_DIALECT:postgres} #数据库方言
timescaledb:
# 默认使用timescaledb来存储设备数据,如果使用mysql,需要设置为false或配置shared-spring为false以及r2dbc相关配置.
enabled: true
shared-spring: true # 默认共享spring的连接
# r2dbc: # 这里仅支持timescaledb,请勿修改成其他数据库.
# url: r2dbc:postgresql://localhost:15432/jetlinks
# username: postgres
# password: p@ssw0rd
schema: ${TIMESCALEDB_SCHEMA:${easyorm.default-schema}} # timescaledb的schema,默认public
function-schema: ${TIMESCALEDB_FUNCTION_SCHEMA:${timescaledb.schema}} #时序数据所用到相关函数所在的schema
time-series:
enabled: true
retention-policies:
# 设备会话统计,只保留30天
- table: device_session_metric
interval: 30d
# 设备消息统计,只保留30天
- table: device_metrics
interval: 30d
things-data:
enabled: true # 开启设备数据存储
# retention-policy: 30d # 保留策略,30天
# chunk-time-interval: 1d # 分区时间间隔,1天
tdengine:
enabled: false # 使用tdengine来存储设备数据
database: jetlinks
restful:
endpoints:
- http://127.0.0.1:6041/
username: root
password: taosdata
elasticsearch:
index:
default-strategy: time-by-month #默认es的索引按月进行分表, direct则为直接操作索引.
settings:
number-of-shards: 1 # es 分片数量
number-of-replicas: 0 # 副本数量
device:
message:
writer:
time-series:
enabled: true #对设备数据进行持久化
captcha:
enabled: false # 开启验证码
ttl: 2m #验证码过期时间,2分钟
hsweb:
cors:
enable: true
configs:
- path: /**
allowed-headers: "*"
allowed-methods: [ "GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS" ]
allowed-origins: [ "*" ] ## 生产环境请替换为具体的域名端口如: http://xxxxx
max-age: 1800
dict:
enum-packages: org.jetlinks
webflux:
response-wrapper:
enabled: true #开启响应包装器(将返回值包装为ResponseMessage)
excludes: # 这下包下的接口不包装
- org.springdoc
authorize:
auto-parse: true
# user-token:
# allopatric-login-mode: offlineOther # 设置异地登录模式为 将其他地方登录的相同用户踢下线
# allopatric-login-modes:
# app: offlineOther
permission:
initialize:
enabled-dimensions: api-client
filter:
enabled: true # 设置为true开启权限过滤,赋权时,不能赋予比自己多的权限.
exclude-username: admin # admin用户不受上述限制
un-auth-strategy: ignore # error表示:发生越权时,抛出403错误. ignore表示会忽略越权的赋权.
cache:
type: redis
redis:
local-cache-type: guava
file:
manager:
storage-base-path: ./data/files
api:
# 访问api接口的根地址
base-path: http://${EXTERNAL_HOST:127.0.0.1}:${EXTERNAL_PORT:${server.port}}
jetlinks:
server-id: ${spring.application.name}:${server.port} #设备服务网关服务ID,不同服务请设置不同的ID
logging:
system:
context:
server: ${spring.application.name}
device:
storage:
default-policy: timescaledb-row # 默认设备数据存储策略
enable-last-data-in-db: false # 是否将设备最新到数据存储到数据库
authentication:
defaults:
user:
admin:
- "*:*"
user-init:
enabled: true
users: # 系统初始用户密码
- username: admin
password: ${ADMIN_USER_PASSWORD:JetLinks.C0mmVn1ty}
name: Administrator
type: admin
rule:
engine:
server-id: ${jetlinks.server-id}
server-name: ${spring.application.name}
logging:
level:
org.jetlinks: debug
rule.engine: debug
org.hswebframework: debug
org.springframework.transaction: debug
org.springframework.data.r2dbc.connectionfactory: warn
io.micrometer: warn
org.hswebframework.expands: error
system: debug
org.jetlinks.rule.engine: warn
org.jetlinks.supports.event: warn
org.springframework: warn
org.jetlinks.community.device.message.writer: warn
org.jetlinks.community.timeseries.micrometer: warn
org.jetlinks.community.elastic.search.service.reactive: trace
org.jetlinks.community.network: warn
io.vertx.mqtt.impl: warn
org.jetlinks.supports.scalecube.rpc: warn
"org.jetlinks.community.buffer": warn
org.elasticsearch: error
org.elasticsearch.deprecation: off
"io.vertx.core.impl.ContextImpl": off
"org.hswebframework.web.starter.jackson": warn
"org.jetlinks.community.timescaledb.impl.DefaultTimescaleDBDataWriter": warn
"io.scalecube": warn
"org.jetlinks.community.things.data": warn
"org.hswebframework.web.starter.i18n": warn
logback:
rollingpolicy:
max-file-size: 100MB
max-history: 7
total-size-cap: 10GB
file:
name: ./data/logs/${spring.application.name}_${server.port}.log
path: ./data/logs
threshold:
file: INFO # 文件只记录INFO以上的日志
console: TRACE
event: WARN # 只记录WARN以上的日志到系统日志中
vertx:
max-event-loop-execute-time-unit: seconds
max-event-loop-execute-time: 30
max-worker-execute-time-unit: seconds
max-worker-execute-time: 30
prefer-native-transport: true
micrometer:
time-series:
tags:
server: ${spring.application.name}
metrics:
default:
step: 30s
system:
config:
scopes:
- id: front
name: 前端配置
public-access: true
- id: paths
name: 访问路径配置
public-access: true
properties:
- key: base-path
name: 接口根路径
default-value: ${api.base-path}
- id: amap
name: 高德地图配置
public-access: false
properties:
- key: apiKey # 配置id
name: 高德地图ApiKey # 名称
management:
health:
elasticsearch:
enabled: false
elastic:
metrics:
export:
enabled: false
simple:
metrics:
export:
enabled: false
# knife4j的增强配置,不需要增强可以不配
knife4j:
enable: true
setting:
language: zh_cn
springdoc:
openapi:
info:
title: "jetlinks"
description: "jetlinks平台API"
version: "2.10"
api-docs:
enabled: true
path: /v3/api-docs
swagger-ui:
path: /swagger-ui.html
use-root-path: false
enabled: true
disable-swagger-default-url: true
# packages-to-scan: org.jetlinks
group-configs:
- group: 设备管理相关接口
packages-to-scan:
- org.jetlinks.community.device
paths-to-exclude:
- /device-instance/**
- /device-product/**
- /protocol/**
- group: 规则引擎相关接口
packages-to-scan: org.jetlinks.community.rule.engine.web
paths-to-exclude: /api/**
- group: 通知管理相关接口
packages-to-scan: org.jetlinks.community.notify.manager.web
- group: 设备接入相关接口
packages-to-scan:
- org.jetlinks.community.network.manager.web
- org.jetlinks.community.device.web
paths-to-match:
- /gateway/**
- /network/**
- /protocol/**
- group: 系统管理相关接口
packages-to-scan:
- org.jetlinks.community.auth
- org.hswebframework.web.system.authorization.defaults.webflux
- org.hswebframework.web.file
- org.jetlinks.community.io.file.web
- org.hswebframework.web.authorization.basic.web
- org.jetlinks.community.logging.controller
cache:
disabled: false
network:
resources:
- 1883-1890
- 8800-8810
- 5060-5061
trace:
# 开启链路追踪
enabled: true
jaeger: # https://hanta.yuque.com/px7kg1/dev/nn2r53n5w8ttap8a
enabled: false # 记录链路数据到jaeger
endpoint: "http://127.0.0.1:14250"
ignore-spans:
- "/device/*/upstream"
- "/device/*/decode"
- "/java/TimeSeriesMessageWriterConnector/writeDeviceMessageToTs"
- "/java/DeviceStatusMeasurementProvider/incrementOnline"
- "/java/DeviceMessageMeasurementProvider/incrementMessage"