Files
iotlcm/config/admin-svr/config.yaml
T
MiFaZhan d84f93ce0a feat: 内置 TDengine 时序库,自动建库建表
此前编排不含时序库,首页流量/用量图表、单卡流量历史等依赖时序数据的功能
不可用。现补上:

- 新增 tdengine 服务(镜像 iotlcm/iotlcm:tdengine-3.3.6.13)
  端口 6041(taosAdapter/WebSocket,应用用这个)+ 6030,数据卷 ./data/tdengine
- 新增 tdengine-init 一次性服务:等 tdengine 健康后建库建表,并校验超级表存在,
  缺表则以非零码退出
- 建库建表 SQL 取自生产环境 SHOW CREATE STABLE(仅结构无数据):
  iotlcm_daily   DURATION 7d  KEEP 1095d  ms  -> t_sim_card_usage_daily
  iotlcm_monthly DURATION 30d KEEP 1095d  ms  -> t_sim_card_usage_monthly
- 三个服务的 tsdb.tdengine 配置指向 tdengine:6041(admin-svr / app-server / worker-svr)

踩坑记录:taos -f 是按行执行语句的,多行 CREATE STABLE 会报
Incomplete SQL statement,因此 SQL 必须单行;且 taos 出错时退出码仍为 0,
故 run.sh 额外做超级表校验。

已验证:初始化 4 条语句全部 Create OK、0 error;按 worker 的 INSERT 形式
(USING ... TAGS)写入成功、按 admin 的查询形式(SELECT ts,usage_mb,package_code,iccid)
可读回;整栈 15 个服务全 Up,admin-svr/openapi/sms/docs 均 200,worker 无时序库报错。
2026-10-30 10:02:32 +08:00

230 lines
5.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# iotlcm-admin-svr 配置
#
# 本文件随部署仓分发,已带可运行默认值,无需复制或改名。
# 正式上线前请修改口令等敏感项;修改时需与 docker-compose.yml、
# schema/init.sql 及 config/ 下其他文件保持一致(详见 README)。
# ============================================================
system:
name: "IotLCM"
version: "1.0"
description: "IotLCM Server"
gfmode: "prod" # prod / dev
upload:
local:
path: "resource/upload"
workerDiagnostic:
enabled: true
server:
address: ":8008"
openapiPath: "/api.json"
swaggerPath: "/swagger"
indexFiles: ["index.html", "index.htm"]
indexFolder: false
fileServerEnabled: true
initLoadMemoryDB: false
maxHeaderBytes: "20KB"
clientMaxBodySize: "200MB"
logger:
path: "/app/logs"
file: "{Y-m-d-H}.log"
prefix: ""
level: "info"
timeFormat: "2006-01-02T15:04:05"
ctxKeys: []
header: true
stdout: true
rotateSize: 0
rotateExpire: 0
rotateBackupLimit: 0
rotateBackupExpire: 0
rotateBackupCompress: 0
rotateCheckInterval: "1h"
stdoutColorDisabled: false
writerColorEnable: false
# ---------- JWT ----------
# 必改:signingKey 必须与 openapi、app-server 完全一致。
jwt:
signingKey: "1f8b3c5d7e9a2b4c6d8e0f1a3b5c7d9e1f8b3c5d7e9a2b4c6d8e0f1a3b5c7d9e"
expiresTime: 7d
bufferTime: 1d
issuer: iotlcm
captcha:
keyLong: 6
imgWidth: 240
imgHeight: 80
openCaptcha: 0
openCaptchaTimeout: 3600
# ---------- 数据库 ----------
database:
# 旧平台库(历史数据对接)。不使用时空 link 即可。
legacyCard:
link: ""
debug: false
maxOpen: 5
maxIdle: 2
logger:
path: "/app/logs"
level: "all"
stdout: true
default:
# 使用与其余服务相同的 u_iotlcm 应用账号。
link: "mysql:u_iotlcm:Iotlcm2026Default@tcp(mysql:3306)/db_iotlcm?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai"
debug: false
charset: "utf8mb4"
dryRun: false
maxIdle: 30
maxOpen: 100
maxLifetime: 120
memorydb:
link: "sqlite::@file(:memory:)"
debug: false
maxIdle: 1
maxOpen: 1
maxLifetime: 30
cache:
adapter: "redis"
fileDir: "/app/cache"
batch:
allocate:
chunkSize: 5000
maxFileSize: 52428800 # 50MB
# ---------- 流量预警 ----------
warning:
expire:
firstWarnDays: 30
secondWarnDays: 15
thirdWarnDays: 7
# 短信通道:指向 iotlcm-sms 服务。不用短信时 enabled 改 false。
sms:
enabled: true
url: "http://iotlcm-sms:11190/api/v1/sms/send"
grpcAddr: "iotlcm-sms:11200"
timeout: "5s"
# 以下为短信服务商参数,一般留空(由 sms 服务统一持有)
routerId: 0
serviceType: ""
regionId: ""
accessKeyId: ""
accessKeySecret: ""
sdkAppId: ""
signName: ""
templateId: ""
msgContentTemplate: ""
# 微信小程序订阅消息。不用时 enabled 改 false。
wechat:
enabled: false
appId: ""
appSecret: ""
templateId: ""
page: "pages/message/index"
timeout: "5s"
# ---------- 注册验证码 ----------
register:
# 走 HTTP 短信网关
sms:
url: ""
method: "POST"
headers: {}
bodyTemplate: '{"phone":"{contact}","code":"{code}"}'
successStatus: 200
# 走 SMTP 邮件
email:
host: "" # 如 smtp.example.com
port: 465
username: ""
password: ""
from: ""
fromName: "物联网卡管理平台"
subject: "注册验证码"
bodyTemplate: "您的注册验证码是:{code},6小时内有效。"
ssl: true
# ---------- Redis ----------
redis:
default:
mode: "single" # single / cluster / sentinel
sentinelMasterName: ""
address: "redis:6379"
db: 0
pass: "Iotlcm2026Default"
minIdle: 5
maxIdle: 30
maxActive: 5000
idleTimeout: "60s"
ClientName: "SystemCache"
# ---------- RabbitMQ ----------
rabbitmq:
enabled: true
dsn: "amqp://iotlcm:Iotlcm2026Default@rabbitmq:5672/"
# ---------- TDengine(流量历史) ----------
# 需要 TDengine 3.x 的 WebSocket 接口(6041)。
# 不启用时序库时 link 留空,历史流量相关功能不可用。
tsdb:
database: "TdEngine"
tdengine:
type: "taosWS"
# TDengine 3.x WebSocket 地址(容器内服务名 tdengine,端口 6041)
# 口令为 TDengine 默认 root/taosdata;改过口令需同步改这里
dsn: "root:taosdata@ws(tdengine:6041)/"
# dbName 只是连接池键名与兜底值,不决定实际访问哪个库
dbName: "iotlcm_daily"
dailyDbName: "iotlcm_daily"
monthlyDbName: "iotlcm_monthly"
maxOpenConns: 100
maxIdleConns: 10
# ---------- 免登录白名单 ----------
router:
exceptLogin:
- /api/v1/system/auth/login
- /api/v1/system/auth/refresh
- /api/v1/system/captcha
- /api/v1/system/auth/getTenantList
- /openapi/v3/query/token
- /api/v1/system/tTplatformSetting/view
- /api/v1/pay/alipay/notify
- /api/v1/pay/alipay/return
# ---------- 支付宝(可选) ----------
# 不使用支付功能时整段删掉。
alipay:
appId: ""
privateKey: ""
alipayPublicKey: ""
notifyUrl: "https://your-domain.example.com/api/v1/pay/alipay/notify"
returnUrl: "https://your-domain.example.com/#/enterpriseManagement/tBalanceDetail/tAgentBalance"
isProduction: false
pay:
expireTime: 60
balanceRecharge:
timeoutDelay: "30m"
# ---------- 上游服务地址 ----------
# 指向同 compose 内的服务名,一般无需修改。
upstream:
# 控制台智能诊断内部凭据,须与 upstream-proxy 的 appDiagnosis.internalToken 一致
appDiagnosisToken: "iotlcm_diagnosis_2026"
proxy:
address: "upstream-proxy:8510"
timeout: 10s
gateway:
address: "upstream-chan:8110"
timeout: 10s