update: 编辑整理文档 architecture
MemRelay-Operation: curated-update:44fc1143-7dee-4e0a-8086-42b65f39e0de:2 MemRelay-Resource: 44fc1143-7dee-4e0a-8086-42b65f39e0de
This commit is contained in:
-315
File diff suppressed because one or more lines are too long
-74
@@ -1,74 +0,0 @@
|
|||||||
---
|
|
||||||
title: Metrix System Architecture Overview
|
|
||||||
type: curated
|
|
||||||
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/curated/development/metrix-system-architecture-overview
|
|
||||||
stable_id: 44fc1143-7dee-4e0a-8086-42b65f39e0de
|
|
||||||
scope: project
|
|
||||||
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
|
|
||||||
workspace_type: development
|
|
||||||
usage_profile_id: null
|
|
||||||
preference_context: development
|
|
||||||
document_type: architecture
|
|
||||||
revision: 1
|
|
||||||
source_memory_ids: []
|
|
||||||
source_checkpoint_ids: []
|
|
||||||
source_file_ids: []
|
|
||||||
source_git_commit: e660bc7bb4fc5ccda47decb4d514874a148ed9b2
|
|
||||||
source_git_commits:
|
|
||||||
- e660bc7bb4fc5ccda47decb4d514874a148ed9b2
|
|
||||||
source_agent_sync_ids: []
|
|
||||||
model_connection: Sub2API
|
|
||||||
model_name: git-restore
|
|
||||||
source_count: 29
|
|
||||||
source_revisions: {}
|
|
||||||
source_dispositions:
|
|
||||||
processed: 29
|
|
||||||
unchanged: 0
|
|
||||||
unsupported: 0
|
|
||||||
skipped: 0
|
|
||||||
cited_source_ids:
|
|
||||||
- git:server/app/main.py
|
|
||||||
- git:server/app/modules/registry.py
|
|
||||||
- git:server/app/core/permissions.py
|
|
||||||
- git:server/app/core/security.py
|
|
||||||
- git:server/app/db/init.py
|
|
||||||
- git:server/app/migrations/registry.py
|
|
||||||
job_cited_source_ids: []
|
|
||||||
conflicts: []
|
|
||||||
supersedes: []
|
|
||||||
preferences: []
|
|
||||||
source_cursor: 162
|
|
||||||
source_hash: e2fcea7c8a9e0df7a91925fb2a9beabd922058868310effc908f95df2d78b218
|
|
||||||
prompt_version: 2026-08-12.3
|
|
||||||
schema_version: '3'
|
|
||||||
curation_job_id: null
|
|
||||||
created_at: '2026-08-19T02:32:26.402300+00:00'
|
|
||||||
updated_at: '2026-09-23T15:09:27.554762+00:00'
|
|
||||||
tags:
|
|
||||||
- architecture
|
|
||||||
- fastapi
|
|
||||||
- vue
|
|
||||||
- modules
|
|
||||||
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
|
|
||||||
---
|
|
||||||
|
|
||||||
## Architecture Overview (2026‑08‑26)
|
|
||||||
|
|
||||||
| Layer | Component | Key Notes |
|
|
||||||
|------|-----------|-----------|
|
|
||||||
| **API Gateway / FastAPI Core** | `git:server/app/main.py` | FastAPI app factory, OpenAPI, CORS, SPA fallback |
|
|
||||||
| **Module Registry** | `git:server/app/modules/registry.py` | Discovers `APP_MODULE` objects, validates keys & deps |
|
|
||||||
| **Permission Framework** | `git:server/app/core/permissions.py` | Action‑based RBAC; `action:* → read` |
|
|
||||||
| **Security Utils** | `git:server/app/core/security.py` | PBKDF2‑SHA256 hashing, `mtx_` API‑tokens, Fernet secrets |
|
|
||||||
| **Database Sub‑system** | ORM models, `git:server/app/db/init.py`, migrations | SQLAlchemy sessions, alembic‑style registry |
|
|
||||||
| **Containers Module** | Docker client, WS xterm.js terminal | `modules/containers/...` |
|
|
||||||
| **Database Module** | Export/Import, APScheduler jobs, pagination |
|
|
||||||
| **Scripts Execution Platform** | Preset Docker images, quota, retention policies |
|
|
||||||
| **Storage API** | FTP/SFTP adapters, file‑tree service (depth/size caps) |
|
|
||||||
| **Offline Docker Deployment** | `scripts/build_docker.py` → `metrix‑app‑latest.tar` (+ optional MySQL & internal PyPI) |
|
|
||||||
| **Front‑End SPA** | Vue 3 + TypeScript + Vite + Naïve‑UI; i18n (EN/ZH), dark/light themes, Monaco + Shiki, Playwright tests |
|
|
||||||
| **CI / Regression** | Playwright end‑to‑end suite (`tests/regression/framework.spec.ts`) |
|
|
||||||
|
|
||||||
**Module Interaction Flow** – router guard → auth store → API client → registered pages → background job polling.
|
|
||||||
|
|
||||||
The architecture reflects the stable state captured on **2026‑08‑26** (see Current State).
|
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
---
|
||||||
|
title: Metrix 实际架构与模块边界
|
||||||
|
type: curated
|
||||||
|
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/curated/development/metrix-实际架构与模块边界
|
||||||
|
stable_id: 44fc1143-7dee-4e0a-8086-42b65f39e0de
|
||||||
|
scope: project
|
||||||
|
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
|
||||||
|
workspace_type: development
|
||||||
|
usage_profile_id: null
|
||||||
|
preference_context: development
|
||||||
|
document_type: architecture
|
||||||
|
revision: 2
|
||||||
|
source_memory_ids: []
|
||||||
|
source_checkpoint_ids: []
|
||||||
|
source_file_ids: []
|
||||||
|
source_git_commit: e660bc7bb4fc5ccda47decb4d514874a148ed9b2
|
||||||
|
source_git_commits:
|
||||||
|
- e660bc7bb4fc5ccda47decb4d514874a148ed9b2
|
||||||
|
source_agent_sync_ids: []
|
||||||
|
model_connection: Sub2API
|
||||||
|
model_name: manual
|
||||||
|
source_count: 29
|
||||||
|
source_revisions: {}
|
||||||
|
source_dispositions:
|
||||||
|
processed: 29
|
||||||
|
unchanged: 0
|
||||||
|
unsupported: 0
|
||||||
|
skipped: 0
|
||||||
|
cited_source_ids:
|
||||||
|
- git:server/app/main.py
|
||||||
|
- git:server/app/modules/registry.py
|
||||||
|
- git:server/app/core/permissions.py
|
||||||
|
- git:server/app/core/security.py
|
||||||
|
- git:server/app/db/init.py
|
||||||
|
- git:server/app/migrations/registry.py
|
||||||
|
job_cited_source_ids: []
|
||||||
|
conflicts: []
|
||||||
|
supersedes: []
|
||||||
|
preferences: []
|
||||||
|
source_cursor: 162
|
||||||
|
source_hash: e2fcea7c8a9e0df7a91925fb2a9beabd922058868310effc908f95df2d78b218
|
||||||
|
prompt_version: 2026-08-12.3
|
||||||
|
schema_version: '3'
|
||||||
|
curation_job_id: null
|
||||||
|
created_at: '2026-09-23T15:09:30.147437+00:00'
|
||||||
|
updated_at: '2026-10-08T07:04:34.631434+00:00'
|
||||||
|
tags:
|
||||||
|
- curated
|
||||||
|
- manual
|
||||||
|
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
|
||||||
|
---
|
||||||
|
|
||||||
|
# Metrix 架构
|
||||||
|
|
||||||
|
依据主仓9a1fae5及当前子模块源码。
|
||||||
|
|
||||||
|
- 后端入口 server/app/main.py:FastAPI工厂、CORS、模块router、本地Swagger资源、web/dist托管;不是独立网关服务。
|
||||||
|
- 后端 server/app/modules/registry.py 扫描 APP_MODULE,校验版本/依赖并加载router/model/权限/迁移/生命周期;前端 web/src/modules/registry.ts 发现 */index.ts 并生成页面菜单。
|
||||||
|
- server/app/core/deps.py 区分Web会话/API Token并执行RBAC;权限格式action:<resource>:<action>。API Token复用用户角色权限,require_web_session拒绝Token访问指定管理接口。
|
||||||
|
- core/security.py 使用PBKDF2-SHA256密码散列、API Token哈希与Fernet连接密码加密。
|
||||||
|
- db/session.py 按install.json建立连接,首次连接sync_database完成建表/模块迁移/字段与权限种子同步。migrations/registry.py是自有迁移机制,不依赖Alembic。
|
||||||
|
- database/jobs.py 的导入导出后台任务使用ThreadPoolExecutor;APScheduler仅用于scripts/scheduler.py定时脚本计划。scripts/runs.py线程池或独立线程执行,Docker镜像不得自动pull。
|
||||||
|
- 脚本记录清理参数script_run_retention_hours(默认168)和script_run_retention_count(默认100,每项目),分别0表示不启用该限制,二者同时生效;不是max_count/max_days。
|
||||||
|
- storage:FTP/SFTP;database:外部数据库操作与导入导出;containers:当前宿主Docker;pypi:内网包源管理。
|
||||||
|
- web:Vue3、TypeScript、Naive UI、i18n、Monaco/Shiki/xterm。两个Monaco组件已监听appStore.dark并切换dark-plus/light-plus主题。
|
||||||
|
- plugins/下两独立Git子模块通过API或平台脚本运行器集成,不属于上述自动发现范围。CapacityReport支持Web及Tauri桌面;InterferenceETL为单批Python程序,无专属cron编辑器。
|
||||||
|
|
||||||
|
测试入口:根pytest.ini→server/tests;web smoke/typecheck/build/Playwright。存在测试不代表已有远端CI流水线。线上运行状态需另行实际验证。
|
||||||
Reference in New Issue
Block a user