modify: P1 独立进程经 Zenoh 注册路由(load_mode 双模式共存)

This commit is contained in:
2026-08-14 17:24:25 +08:00
parent b89881ce64
commit fe4d5af9cd
13 changed files with 993 additions and 77 deletions
+5
View File
@@ -340,6 +340,7 @@ uv run serve # 启动开发服务
uv run gen_plugin <name> # 生成统一风格插件骨架
uv run python -m chongming.scripts.gen_models # 生成 Pydantic 模型
uv run python -m chongming.scripts.build # 构建打包(PyInstaller/Nuitka)
uv run worker_serve --type <name> # 以独立进程运行 Worker(load_mode=process)
uv pip install -e utils/<name> # 安装/更新工具包
```
@@ -374,6 +375,10 @@ uv pip install -e utils/<name> # 安装/更新工具包
## 配置说明
- **应用配置**:根目录 `config.toml`,包含环境、服务器、安全、MQTT 等全局设置
- **插件加载模式**:`config.toml` 的 `[<env>.workers].load_mode`
- `"inline"`(默认):插件在网关进程内加载
- `"process"`:插件以独立进程运行(`uv run worker_serve --type <name>`),
经 Zenoh 在 `chongming/routes/**` 注册路由,网关动态挂载 HTTP 端点
- **Zenoh 配置**:`config/zenoh_config.json5`
- **插件注册**:`config/workers/<name>/config.toml` 的 `[workers]` 节,定义加载方式、副本数与运行时配置(旧全局 `config/workers/config.toml` 仅作兜底兼容)
- **路由定义**:`config/workers/<name>/*.toml`,每个端点一个文件