Files
MemRelay/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/curated/development/Metrix 实际架构与模块边界.md
T
memrelay 16773031b1 update: 编辑整理文档 architecture
MemRelay-Operation: curated-update:44fc1143-7dee-4e0a-8086-42b65f39e0de:3
MemRelay-Resource: 44fc1143-7dee-4e0a-8086-42b65f39e0de
2026-10-08 15:54:02 +08:00

69 lines
3.4 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.
---
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: 3
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:53:55.197089+00:00'
tags:
- curated
- manual
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
---
# Metrix 架构
源码基线main@e77a28a;两个独立Git子模块CapacityReport488c540、InterferenceETLba2d3b2。版本变化后同步README/指南/MemRelay。
server/app/main.py为FastAPI工厂、CORS、模块router、本地Swagger及web/dist托管,不是独立网关服务。后端modules/registry.py扫描APP_MODULE并校验key/版本/依赖,加载router/model/权限/迁移/生命周期;前端modules/registry.ts发现*/index.ts声明页面菜单。plugins/不在扫描范围。
core/deps.py区分Web/API Token并执行RBAC;权限action:<resource>:<action>,read页面入口,manage_others跨用户;Token复用角色权限,require_web_session限制管理接口。security使用PBKDF2-SHA256、Token哈希、Fernet。api_enabled是数据库系统设置,不在core/config.py。
db/session.py首次连接sync_database完成建表、模块迁移/字段/权限种子同步;migrations/registry.py是自有机制,不依赖Alembic。主平台FastAPI固定0.136.3,0.142.4改变include_router包装,旧操作名迁移需兼容后才升级。
database/jobs.py导入导出使用线程池;scripts/scheduler.py使用APScheduler,scripts/runs.py线程池或独立线程+Docker执行,镜像不自动pull。保留参数script_run_retention_hours默认168、script_run_retention_count默认每项目100,各自0关闭该限制,二者共同生效。
web为Vue3/TS/Naive UI/i18n/Monaco+Shiki+xterm;脚本及SQL编辑器均监听appStore.dark并切换主题。storage是FTP/SFTP,containers是当前宿主Docker,pypi是内网包源管理。
CapacityReport独立Web/Tauri应用,源/仓库双模式,CellData仍直连;InterferenceETL独立15分钟组批处理,通过平台API协作,无专属cron编辑器。
dev.py只管理已准备的环境,默认四进程,预检及跳过选项见README;pytest/Playwright产物与浏览器缓存统一Temp。现有本地测试不意味着远端已有CI流水线,HTTP服务可用不意味着外部数据库健康。