Files
Nexus/docs/project/status.md
T
Your Name f796ddf0a5 feat: D2 install.php→install.html迁移 + D3 WebSSH终端完善
D2: install.php → install.html + FastAPI API
- 新增 server/api/install.py: 6个安装向导API端点(无JWT)
- 新增 web/app/install.html: Alpine.js五步安装向导
- main.py: 条件启动模式(无.env=安装模式,仅/api/install/可用)
- InstallModeMiddleware: 安装模式下非安装路由返回503
- DbSessionMiddleware: 跳过安装API(自管理临时引擎连接)
- 三写一致性: .env + config.php + MySQL settings表同步

D3: WebSSH terminal.html 完善
- 全功能xterm.js终端 + Koko协议 + 自动resize
- Alpine.js + Tailwind CSS v4 统一风格
- 全屏/断开连接/连接状态指示器

文档更新:
- status.md: 第五步→, 完成度~95%
- roadmap.md: D2技术债务已解决
2026-05-22 08:37:01 +08:00

3.9 KiB

Nexus 项目进度总览

最后更新: 2026-05-22


技术栈

维度 技术
后端 Python 3.12 / FastAPI 0.115.6 / SQLAlchemy 2.0 Async
数据库 MySQL 8.4 (14 表) + Redis 7 (心跳/告警/Pub/Sub)
SSH asyncssh 2.17.0 (引用计数连接池, ADR-004)
认证 JWT + TOTP (PyJWT 2.10.1, ADR-005)
前端 Tailwind CSS v4 + Alpine.js 3.14.8 (纯静态 HTML)
部署 Nginx (模板化) + Supervisor (3层守护)
通信 WebSocket (两层架构, ADR-010) + Telegram

数据库结构(14 张表)

核心表:
  platforms            资产类型模板: name, category, type, default_protocols(JSON)
  nodes                树形分组: name, parent_id, sort_order
  servers (扩展)       id, name, domain, port, username, auth_method,
                       password(加密), ssh_key_*(3), agent_port, agent_api_key,
                       category, is_online, system_info, last_heartbeat,
                       platform_id, node_id, protocols(JSON), extra_attrs(JSON),
                       connectivity, last_checked_at
  admins               username, password_hash, totp_secret, totp_enabled,
                       jwt_refresh_token, jwt_token_expires
  settings             key → value

业务表:
  sync_logs            server_id, source/target_path, status, sync_mode
  push_schedules       name, source_path, server_ids(JSON), cron_expr
  push_retry_jobs      server_id, retry_count, max_retries, next_retry_at
  password_presets      name, encrypted_pw
  db_credentials       db_type, host, port, username, encrypted_password
  scripts              name, category, content
  script_executions    script_id, command, server_ids(JSON), results(JSON)

辅助表:
  audit_logs           admin_username, action, target_type, detail
  login_attempts       username, ip_address, success

Web SSH 表:
  ssh_sessions         UUID id, server_id, admin_id, status, started_at, closed_at
  command_logs         session_id, server_id, admin_id, command

实施进度

第零步:基础设施 — 已完成

  • Redis BlockingConnectionPool + 启动强校验 (ADR-008/009)
  • WebSocket 两层架构 (ADR-010) + JWT 认证 (ADR-011)
  • Dashboard WebSocket 实时告警

第一步:数据层 — 已完成

  • Platform + Node 模型
  • Server 扩展字段 (platform_id, node_id, protocols, extra_attrs, connectivity)
  • CommandLog + SshSession 模型
  • Admin JWT 字段
  • 数据迁移: category → Node

第二步:认证层 — 已完成

  • JWT 登录/刷新/验证
  • TOTP 双因素
  • Tailwind 登录页 + api.js 共享模块

第三步:Web SSH — 已完成

  • asyncssh 引用计数连接池
  • WebSocket 端点 + Koko 协议
  • 会话追踪 + 命令日志
  • xterm.js 前端页面 (terminal.html)

第四步:Sync 引擎 — 已完成

  • 文件/命令/配置/SFTP 四种同步模式
  • Semaphore 并发控制

第五步:前端迁移 — 已完成

  • 12 个 Tailwind+Alpine.js 页面 (含 install.html)
  • api.js JWT 共享模块
  • WebSocket 实时更新
  • install.php → install.html + FastAPI API 迁移
  • 条件启动模式 (install mode vs normal mode)

架构决策

编号 决策 选择 状态
ADR-001 资产模型 Platform + Node + Server 扩展
ADR-002 Web SSH BFF + asyncssh 内嵌 (后端)
ADR-003 前端终端 xterm.js + Koko 协议
ADR-004 SSH 连接池 引用计数模式
ADR-005 认证 JWT + TOTP
ADR-006 前端框架 弃用 AdminLTE → Tailwind
ADR-007 Redis 定位 核心数据层
ADR-008 Redis 池 BlockingConnectionPool
ADR-009 Redis 可用性 启动强校验
ADR-010 WebSocket 内存 + Pub/Sub 两层
ADR-011 WS 认证 JWT 查询参数

总完成度: ~95%