Skip to content

refactor: migrate to New API with SQLite - #1

Merged
ahdg6 merged 2 commits into
mainfrom
refactor/new-api-sqlite
Sep 7, 2026
Merged

ahdg6 merged 2 commits into
mainfrom
refactor/new-api-sqlite

Conversation

@ahdg6

@ahdg6 ahdg6 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

变更

旧部署需要 Hub、CLIProxyAPI 和外部数据库,维护成本较高。现在改成固定版本的 New API 单容器,使用 SQLite 保存账号、渠道、令牌和消费记录,默认监听 127.0.0.1:23000。

  • 移除 Hub / CLIProxyAPI、PostgreSQL / Dragonfly、sing-box 和隧道覆盖文件、OAuth 登录助手及每日 CLIProxyAPI 镜像构建。
  • 新增 new-api-runtime,支持 Podman / Docker、私有本机状态、健康检查、在线 SQLite 一致备份及恢复到空目录。
  • Nix 包和 Home Manager 接口迁移为 new-api-runtime / services.newApiRuntime;已有 dev-runtime 继续单独管理网关,不重复启用服务。
  • 重写部署文档、用量和价格说明、旧系统迁移与回退步骤。移除旧 deploy/ 节点部署和 SSH 工具;历史内容仍可通过 Git 恢复。

Docker 首次选择的引擎和项目名保存到私有 .env;容器按宿主 UID/GID 写入 SQLite,避免备份受 root 文件所有权影响。文档补充本地 CPU 过载拒绝的关闭方法和 1 倍率额度记账。

验证

  • nix flake check --no-update-lock-file:x86_64-linux 包和检查通过;aarch64-linux 未实际构建。
  • 新 Home Manager 模块实际求值通过。
  • 5 个 Python 测试通过:状态权限和幂等、WAL 备份与恢复、拒绝覆盖、Compose 调用边界和 Docker 引擎持久化。
  • 使用 Nix 打包结果在独立 23003 端口完成真实 Podman 启动、健康检查、重启、在线备份、恢复后启动;测试容器已清理。
  • GitHub CI 新增真实 Docker 初始化、文件所有权、重启、在线备份及恢复后启动验证。
  • 现有 dev-runtime 的 23000 网关保持健康。

迁移注意

这是不兼容接口迁移。旧服务、凭据和数据库不自动删除;按 docs/migration.md 完成导出、验证和切换。OAuth 订阅凭据及旧 Hub 历史统计不直接导入,新部署也不捏造模型价格。仓库 URL 保持不变,旧 GHCR 镜像标签不会被替换为 New API。

@ahdg6
ahdg6 merged commit f563fee into main Sep 7, 2026
2 checks passed
@ahdg6
ahdg6 deleted the refactor/new-api-sqlite branch September 7, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant