Files
Migu2.0/README.md
T
黄兆尉andCursor 3686abdc78 将调度内核标识从 SimpleLite 全面重命名为 Simple3。
配置段/环境变量、Launcher、健康检查 API、OpenAPI 与前后端文案同步;兼容探测旧 SimpleLite 进程名。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-26 17:46:52 +08:00

130 lines
4.1 KiB
Markdown
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.
# Migu2.0
迷毂智能调度平台主仓库(平台后端 + 平台前端)。
该仓库承接原 `Simple` 仓库中的平台层能力,当前以 `MiGu.Server` 作为统一入口;调度内核 `Simple3` 仍在相邻仓库 `../Simple` 中维护。
## 仓库定位
- **平台后端**`MiGu.Server`ASP.NET Core 8 + YARP,默认 `:8080`
- **平台前端**`frontends/apps/simple-platform-vue`Vue 3 + Vite
- **调度内核**`Simple3`(不在本仓库,位于 `../Simple/Simple3`
- **运行模式**:用户登录后由 `MiGu.Server` 按启动模式拉起 `Simple3.exe`
## 目录结构
```text
Migu2.0/
├── MiGu.Server/ # 平台后端入口工程
│ ├── Controllers/ # Auth/Config/Ops/Health 等 API
│ ├── Launcher/ # Simple3 子进程拉起与健康探测
│ ├── Auth/ # JWT / 用户鉴权 / 内部 token
│ ├── Configs/ # 平台配置中心模型与存取
│ ├── wwwroot/ # 已构建前端静态资源(部署用)
│ ├── appsettings.json # 启动、YARP、Simple3 路径配置
│ └── README.md # 后端详细说明
├── frontends/ # 平台前端源码 workspace
│ └── apps/simple-platform-vue/
├── build-platform-frontend.bat # 一键构建前端并同步到 MiGu.Server/wwwroot
├── MiGu.Server.sln
├── ARCHITECTURE.md
├── PLATFORM_V3_CHANGES.md
└── Doc/
```
## 与 Simple3 的关系
`Migu2.0``Simple3` 是分仓协作关系:
- `MiGu.Server` 提供登录、权限、配置中心、平台 UI 托管与网关能力
- `Simple3` 提供调度内核、投影接口、3D/仿真运行时能力
- 两者通过以下链路协作:
- **进程编排**`MiGu.Server` 登录后调用 `Simple3Launcher` 拉起 `Simple3.exe`
- **接口代理**`/api/sl/*` 通过 YARP 转发到 `http://127.0.0.1:8222/`
- **3D 页面代理**`/vr/*` 转发到 `http://127.0.0.1:8223/`
默认开发路径(可改)在 `MiGu.Server/appsettings.json`
```json
"Simple3": {
"Enabled": true,
"ExecutablePath": "..\\..\\Simple\\Simple3\\bin\\Debug\\Simple3.exe",
"WorkingDirectory": "..\\..\\Simple\\Simple3\\bin\\Debug",
"ProjectionPort": 8222
}
```
## 快速启动(开发机)
### 1) 先编译 Simple3
```powershell
cd ..\Simple
dotnet build Simple3\Simple3.csproj -c Debug
```
### 2) 启动 MiGu.Server
```powershell
cd ..\Migu2.0\MiGu.Server
dotnet run
```
打开 `http://localhost:8080/login`,使用默认开发账号:
- `admin / admin`
- `ops / ops`
> 仅调试平台页面、不拉起内核:将 `MiGu.Server/appsettings.json` 中 `Simple3.Enabled` 改为 `false`。
## 前端构建与发布
仓库根目录提供脚本:
```powershell
cd E:\Work\Core\Simple-FR\Migu2.0
.\build-platform-frontend.bat
```
该脚本会执行三步:
1.`frontends` 安装依赖(pnpm 优先)
2. 构建 `simple-platform-vue`
3.`dist` 同步到 `MiGu.Server/wwwroot`
仅构建不同步启动后端:
```powershell
.\build-platform-frontend.bat --no-start
```
## 部署说明(生产)
- 发布内容至少包含:
- `MiGu.Server` 可执行文件及依赖
- `MiGu.Server/wwwroot` 静态资源
- 生产环境务必覆盖以下配置(不要使用默认值):
- `Jwt.Secret`
- `Internal.Token`
- `Auth.Users.*.Password`
- `Simple3.ExecutablePath` / `WorkingDirectory`(按部署实际路径)
推荐通过环境变量覆盖(`__` 表示层级):
```powershell
$env:Jwt__Secret = "<strong-secret>"
$env:Internal__Token = "<internal-token>"
$env:Auth__Users__admin__Password = "<strong-password>"
```
## 常见检查点
- `http://localhost:8080/api/health`:后端健康
- `http://localhost:8080/api/health/simple3`Simple3 路径与端口诊断
- 访问平台时若出现 `502`:通常表示 `Simple3``8222` 未就绪或未启动
## 相关文档
- `MiGu.Server/README.md`:后端细节(鉴权、YARP、启动参数、联调)
- `ARCHITECTURE.md`:整体架构说明
- `PLATFORM_V3_CHANGES.md`V3 变更记录