diff --git a/docs/server-verification.md b/docs/server-verification.md new file mode 100644 index 0000000..b757fce --- /dev/null +++ b/docs/server-verification.md @@ -0,0 +1,41 @@ +# 服务器验收记录 + +日期:2026-10-11。代码:`feat/debian-server`;运行版本包含 `fcdf6f2`。这份记录只列公开运行状态,不包含访问密码、数据库密码、Cookie 或密钥。 + +## 自动检查 + +| 检查 | 结果 | +| --- | --- | +| Windows 后端完整测试 | 76 通过,6 个需要实际 MariaDB 的测试跳过 | +| Debian Python 3.11 后端完整测试 | 68 通过,14 个 Windows 平台测试跳过;包含 6 个实际 MariaDB 集成测试 | +| 前端测试 | Windows、Debian 均 3 通过 | +| TypeScript 与 Vite 生产构建 | 两端均通过,服务器实际使用构建后的网页 | +| 独立全分支审查 | 登录验证后的重试固定出口、账号登录固定出口、迁移拒绝不修改旧任务三项问题均已修复并通过回归验证 | +| `nginx -t` | 全服务器配置通过 | + +后端有一条既有 Starlette 弃用提示。真实 MariaDB 测试使用独立 `kaoyan_studio_test` 数据库,未把测试记录写入正式库。 + +## 实际服务与数据 + +- 工作台、代理 API、抓取调度器均为 `active`、`enabled`;独立 Redis 容器运行且设置 `unless-stopped`。 +- MariaDB 10.11.18,正式数据库 `kaoyan_studio`;HTTP 健康接口报告 `database=mysql`、`platform=linux`。 +- 从本机在线 SQLite 快照迁移目录 27,901 条、历史线 0 条、院校索引 559 条、任务 4 个、完成单元 4,302 条、日志 4,319 条。 +- 目录、历史线、任务、完成单元、日志与原 SQLite 内容相同;启动时两个院校索引名称被内置种子刷新,详见部署说明。目录的原始名称不变。 +- 原全国任务 `19f9b363a1dd4f2b8a384d84351b1b61` 保持手动暂停,记录 27,901、完成单元 4,282;服务器重启后仍保持暂停。本机原任务也保持暂停。 +- 登录 Cookie 在服务器以权限 0600 的密钥重新加密保存。实际第二页验证返回 `login_required`,界面据实显示需重新登录;不会继承 Windows 已验证标记。 +- 请求间隔上下限 1.2、2.4 秒;自动代理轮换阈值 100 次成功请求。代理池启动时已有 56 个 HTTP 候选、没有 HTTPS 候选;工作台保留原电脑的 24 个 HTTPS 备用出口,实际验证请求通过其中的代理完成。 + +## HTTPS 与浏览器 + +- `https://186.241.68.230:9443` 从用户电脑可访问;使用系统信任的有效 IP 证书,API 验收和浏览器验收均未忽略证书错误。 +- 未认证请求返回 401;提供工作台账号后目录查询、详情、任务、设置、代理服务接口均返回正常结果。 +- 真实跨来源修改返回 403;同来源保存原设置返回 200。 +- 通过页面使用的管理 API 停止和启动代理服务成功,只操作本项目 API 与调度器,独立 Redis 保持运行。 +- Edge 无界面验收:数据概览、实际目录表格、Linux 登录提示、代理池状态、手机宽度正常,没有浏览器脚本异常。 +- Cookie 说明、顶部运行位置与数据保存位置显示为服务器;Linux 页面不显示打开服务器 Edge 窗口的按钮。 +- IP 证书的续期模拟成功,现有 `certbot.timer` 调用 Certbot 5.8.0,续期后 reload Nginx。 +- `https://kaoyan.fjayson.com` 当前仍出现 HTTPS 跳回相同 URL 的 301;CDN 使用 HTTP 回源,需要用户改为 HTTPS 443,并处理源站 IP 证书的名称校验。DNS 指向 CDN 节点本身不影响部署。 + +## 私密备份 + +服务器 `/var/backups/kaoyan-studio/` 权限 0700,数据库备份权限 0600;保存数据库、含 Cookie 加密密钥的运行目录、私密数据库配置和 Nginx 认证文件。原 SQLite 快照保留在部署目录的 `incoming/`。访问账号单独交付到用户电脑。 diff --git a/docs/superpowers/plans/2026-10-11-debian-server.md b/docs/superpowers/plans/2026-10-11-debian-server.md index 1411b94..1ff42c4 100644 --- a/docs/superpowers/plans/2026-10-11-debian-server.md +++ b/docs/superpowers/plans/2026-10-11-debian-server.md @@ -30,34 +30,38 @@ Files: studio/settings.py, studio/network.py, studio/auth.py, tests/test_server_features.py. -- [ ] Add failing tests for varied bounded delays, invalid bounds, automatic route changes, and pinned verification. -- [ ] Implement interval maximum and proxy rotation settings, actual request route/count reporting, and route pinning during auth verification. -- [ ] Run network and auth tests, then commit. +- [x] Add failing tests for varied bounded delays, invalid bounds, automatic route changes, and pinned verification. +- [x] Implement interval maximum and proxy rotation settings, actual request route/count reporting, and route pinning during auth verification. +- [x] Run network and auth tests, then commit. ### Task 2: MariaDB backend and migration Files: studio/mysql_database.py, studio/migrate.py, studio/api.py, tests/test_mysql.py, pyproject.toml. -- [ ] Write tests against a real isolated MariaDB database for upserts, historical scopes, favorites, jobs, and atomic migration. -- [ ] Implement MySQLDatabase.connection(), preserving the existing Database API; load private database configuration through STUDIO_DATABASE_CONFIG. -- [ ] Implement migrate_sqlite(source, target) preserving IDs, logs and unit keys and rejecting nonempty targets. -- [ ] Verify all existing tests and real MariaDB integration tests, then commit. +- [x] Write tests against a real isolated MariaDB database for upserts, historical scopes, favorites, jobs, and atomic migration. +- [x] Implement MySQLDatabase.connection(), preserving the existing Database API; load private database configuration through STUDIO_DATABASE_CONFIG. +- [x] Implement migrate_sqlite(source, target) preserving IDs, logs and unit keys and rejecting nonempty targets. +- [x] Verify all existing tests and real MariaDB integration tests, then commit. ### Task 3: Linux operation and user interface Files: studio/auth.py, studio/linux_pool.py, studio/pool_service.py, studio/__main__.py, studio/api.py, frontend/src/App.tsx, frontend/src/types.ts. -- [ ] Add failing tests for Linux vault roundtrip/permissions, server host filtering, and interrupted-task recovery selection. -- [ ] Implement encrypted Linux storage, explicit manual-cookie login instructions, Linux systemd pool controls, configured hosts/data directory, and opt-in restart resumption. -- [ ] Add interval range, rotation settings and counters to the UI; use capability metadata for platform instructions. -- [ ] Run full backend tests and frontend tests/build, then commit. +- [x] Add failing tests for Linux vault roundtrip/permissions, server host filtering, and interrupted-task recovery selection. +- [x] Implement encrypted Linux storage, explicit manual-cookie login instructions, Linux systemd pool controls, configured hosts/data directory, and opt-in restart resumption. +- [x] Add interval range, rotation settings and counters to the UI; use capability metadata for platform instructions. +- [x] Run full backend tests and frontend tests/build, then commit. ### Task 4: Provision, migrate, and deploy Files: deploy/*, docs/debian-deployment.md, README.md. -- [ ] Prepare reproducible systemd, Nginx and private configuration templates with rollback and backup instructions. -- [ ] Provision independent MariaDB account/database, dedicated loopback Redis, proxy pool and workbench services. -- [ ] Transfer online SQLite backup and credentials through SSH without exposing secrets; verify migrated data and server login. -- [ ] Validate authenticated HTTPS, browser workflows, proxy API/scheduler and restart persistence; resume migrated task only after valid authentication. -- [ ] Fresh reviewer checks the whole branch; fix material findings and verify again. Publish the deployment branch to the user's repository. +- [x] Prepare reproducible systemd, Nginx and private configuration templates with rollback and backup instructions. +- [x] Provision independent MariaDB account/database, dedicated loopback Redis, proxy pool and workbench services. +- [x] Transfer online SQLite backup and credentials through SSH without exposing secrets; verify migrated data and server login. +- [x] Validate authenticated IP HTTPS, browser workflows, proxy API/scheduler and restart persistence; preserve the manually paused migrated task and report its actual login state. +- [x] Fresh reviewer checks the whole branch; fix material findings and verify again. Publish the deployment branch to the user's repository. + +### External follow-up + +- [ ] User changes CDN origin to HTTPS 443; verify public domain access afterward. Authenticated IP HTTPS access is already available.