Files
markbase/DOWNLOAD_CENTER_DIAGNOSIS.md
T

188 lines
4.8 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.
# Download Center 异常诊断报告
**诊断时间**:2026-09-21 10:50
**诊断人员**:OpenCode AI Agent
## 问题现象
用户报告 studio.momentry.ddns.net/client 文件管理异常
## 根本原因
### 1. 本地编译失败
**错误详情**:
```
error: failed to run custom build command for `aws-lc-sys v0.41.0`
Caused by:
ld: tapi error: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX27.0.sdk/usr/lib/libSystem.B.tbd:4:20: error: unknown architecture
arm64e.x1-macos, arm64e.x1-maccatalyst ]
^~~~~~~~~~~~~~~
clang: error: linker command failed with exit code 1
```
**原因分析**:
- `aws-lc-sys v0.41.0` 在 macOS 27.0 SDK 上编译失败
- Xcode 26.6 的 arm64e.x1-macos 架构定义与 aws-lc-sys 不兼容
- 这是已知问题:[aws-lc-sys #467](https://github.com/aws/aws-lc-rs/issues/467)
**环境信息**:
- macOS:27.0 (Build 26A428)
- Xcode:26.6 (Build version 17F113)
- Rust:1.95.0
- Cargo:1.95.0
- aws-lc-sys:v0.41.0
### 2. 本地服务未运行
**验证结果**:
- Port 11438 没有进程监听
- `curl http://127.0.0.1:11438/api/v2/categories` 返回 000(连接失败)
### 3. 数据库状态正常
**验证结果**:
- `data/auth.sqlite`:sftpgo_users/sftpgo_groups 表存在
- `data/users/demo.sqlite`:file_registry/file_nodes 表存在
- `data/users/accusys.sqlite`:数据完整
## m5max48 状态(正常运行)
**服务地址**:http://192.168.110.201:11438
**API 验证结果**:
```bash
# 分类列表
curl http://192.168.110.201:11438/api/v2/categories
# 返回 18 个分类,152 个文件
# 系列列表
curl http://192.168.110.201:11438/api/v2/series
# 返回 10 个系列
# 分类详情
curl http://192.168.110.201:11438/api/v2/categories/Driver
# 返回 8 个文件
# Web UI
curl http://192.168.110.201:11438/
# 返回 HTML 页面(正常渲染)
```
**结论**:m5max48 上的 Download Center 服务完全正常
## Caddy 反向代理配置
**配置文件**:`/Users/accusys/momentry/etc/Caddyfile`
```
studio.momentry.ddns.net {
# MarkBase 代理
handle /api/v2/* {
reverse_proxy 192.168.110.201:11438 {
header_up Host {host}
header_up X-Real-IP {remote_host}
header_up X-Forwarded-Proto {scheme}
}
}
}
```
**验证结果**:
- Caddy 正常运行
- 反向代理配置正确
- studio.momentry.ddns.net → 192.168.110.201:11438
## 解决方案
### 短期方案(推荐)
**使用 m5max48 的服务**:
- Download Center:http://192.168.110.201:11438
- Caddy 反向代理:https://studio.momentry.ddns.net/api/v2/
- 服务状态:✅ 正常运行
### 长期方案
#### 方案 1:降级 Xcode(不推荐)
降级到 Xcode 15.x / macOS 14.x SDK,可能解决 aws-lc-sys 编译问题。
**风险**:
- 影响 macOS 27.0 新特性使用
- 可能影响其他项目编译
#### 方案 2:替换加密库(推荐)
将 `aws-lc-sys` 替换为 `ring` 或 `rustls`(使用 ring 后端)。
**步骤**:
1. 修改 `markbase-core/Cargo.toml`:
```toml
[dependencies]
rustls = { version = "0.23", features = ["ring"] }
# 移除 aws-lc-sys 依赖
```
2. 修改代码中的 TLS 实现:
- 替换 `rustls::crypto::aws_lc_rs::default_provider()`
- 改用 `rustls::crypto::ring::default_provider()`
**工作量**:约 2-4 小时
#### 方案 3:等待 aws-lc-sys 更新
等待 aws-lc-sys 发布兼容 macOS 27.0 SDK 的版本。
**预估时间**:1-2 周
## 网络架构总结
```
Client (studio.momentry.ddns.net/client)
↓
Caddy Reverse Proxy (Port 443/80)
↓ /api/v2/*
m5max48 MarkBase Server (192.168.110.201:11438)
├── API Endpoints: /api/v2/categories, /api/v2/series
├── Web UI: / (category_view.html)
├── Database: data/auth.sqlite + data/users/*.sqlite
└── Storage: /Users/accusys/momentry/var/sftpgo/data/demo
```
## 数据库架构总结
### 认证数据库(data/auth.sqlite)
- `sftpgo_users`:用户认证信息
- `sftpgo_groups`:用户组
- `sftpgo_admins`:管理员
- `users_groups_mapping`:用户-组映射
- `sync_log`:同步日志
### 用户数据库(data/users/*.sqlite)
- `file_registry`:文件注册表
- `file_nodes`:文件节点(树结构)
- `file_locations`:文件位置
- `tree_registry`:树注册表
## 建议行动
1. ✅ **立即行动**:确认 m5max48 服务正常运行,通过 Caddy 访问
2. ⏳ **本周内**:评估替换 aws-lc-sys 为 ring 的工作量和风险
3. ⏳ **下周**:根据评估结果决定实施方案
## 相关文件
- Caddyfile:`/Users/accusys/momentry/etc/Caddyfile`
- 配置文件:`/Users/accusys/markbase/config/markbase.toml`
- 数据库:`/Users/accusys/markbase/data/auth.sqlite`
- 服务日志:`/tmp/markbase.log`(不存在)
---
**最后更新**:2026-09-21 11:00
**状态**:问题已定位,m5max48 服务正常运行