foms_app/README.md
yumoqing 594f02a49d feat: foms_app 纯伞(应用壳)— 组装与启动,无业务逻辑
业务全部在独立模块仓库(foms / dbbackup / filesync / hostwatch),
本仓只做:入口组装、build、conf、start/stop、首页、RBAC 权限注册。

内容:
  · app/foms.py        入口,按序 load 全部模块
  · app/global_func.py get_module_dbname(统一库 foms)
  · build.sh           clone+安装全部模块、生成 DDL/CRUD、挂载 wwwroot
  · conf/config.json   website.paths:foms 根路径 + 三模块前缀
  · init/data.yaml     全部 codes(含拆分后新增的 codes)
  · scripts/load_path.py  重写为新 URL 布局
  · wwwroot/index.ui   首页(指向各模块前缀路径)

从 foms 仓库迁出的应用层文件(app/build/conf/start/stop/index.ui/data.yaml/
init_rbac/load_path)在 foms 侧已删除。
2026-08-27 11:08:38 +08:00

52 lines
1.9 KiB
Markdown
Raw Permalink 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.

# foms_app — FOMS 纯伞(应用壳)
本仓库是 FOMS 的**纯伞**:只做组装与启动,不含任何业务逻辑。
业务全部在独立模块仓库,伞通过 `build.sh` 拉取、安装、软链、生成页面。
## 仓库职责边界
| 仓库 | 角色 | 内容 |
|---|---|---|
| **foms_app本仓** | 纯伞 | 入口 `app/foms.py``build.sh``conf/``start/stop.sh`、首页 `wwwroot/index.ui``init/data.yaml` |
| foms | 业务模块(核心) | 主备切换编排(六步状态机+防脑裂)、集群/节点/心跳/远程命令、Agent |
| dbbackup | 业务模块 | 数据库备份 + 日志同步binlog 复制) |
| filesync | 业务模块 | 运行文件同步rsync |
| hostwatch | 业务模块 | 日志监控 + 日志分析 + 主机指标 |
## 构建
```bash
./build.sh
```
build.sh 做的事(全部是组装,无业务):
1. 建 venv
2. clone + 安装基础包apppublic/sqlor/ahserver/bricks-for-python/xls2ddl
3. 构建 bricks 前端,软链到 ./bricks
4. clone + 安装鉴权模块appbase/rbac
5. clone + 安装**全部业务模块**foms/dbbackup/filesync/hostwatch+ 各生成 DDL
6. xls2ui 从各模块 `json/` 生成 CRUD 页面到各模块 `wwwroot/`
7. 把各模块 `wwwroot/` 软链到主 `wwwroot/<模块名>`URL 前缀隔离:`/foms/``/dbbackup/`…)
8. 建运行时目录
## 运行
```bash
cp .env.example .env # 填 MYSQL_ROOT_PASSWORD / FOMS_AGENT_TOKEN / FOMS_PORT
./start.sh # 监听 FOMS_PORT默认 9080
./stop.sh
```
## 数据库
所有模块共享一个库 `foms``get_module_dbname()` 固定返回 'foms')。
建库:依次执行各模块 `models/mysql.ddl.sql`build 后生成)。
## 加载顺序app/foms.py
```
set_globalvariable → load_pybricks → load_appbase → load_rbac
→ load_foms核心注册切换编排器+健康判定器)
→ load_dbbackup → load_filesync → load_hostwatch
```