Files

49 lines
2.3 KiB
Markdown
Raw Permalink 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.
# 镜像同步方案(外部代码库 → git.vanusys.com)
> 版本:v2 · 2026-08-18 · 状态:**Gitea 原生镜像已启用(astryx 已收录)**
> 目标:把我们关注的 GitHub 等外部代码库**定期镜像**到 git.vanusys.com,让内部服务器(宁波、局域网等无法直连 GitHub 的环境)也能直接拉取,并在合集中用子模块统一引用。
## 结论:使用 Gitea 原生镜像(pull mirror)
`git.vanusys.com` 为 **Gitea 1.27.1**,服务器位于**香港**(154.21.200.211,可直连 GitHub)。
采用 **Gitea 仓库镜像(pull mirror)**:Gitea 服务端按周期主动从 GitHub 拉取,**不依赖任何本机定时任务**。
- 镜像仓库:`VanuSystems-Mirror/facebook-astryx`(private,mirror=true;镜像统一放 **VanuSystems-Mirror 组织**)
- 上游:https://github.com/facebook/astryx (MIT,16k+ 提交,~666MB,含 200+ 分支)
- 同步周期:24h(已通过 API 设置 `mirror_interval`)
### 新增镜像的标准流程(下次收录同类仓库)
1. 调 Gitea API 创建镜像仓库(见下)。
2. 等待首次同步完成(大仓库可能需 10~30 分钟)。
3. 在合集中 `git submodule add <内部镜像地址> <分类>/<仓库名>`,提交收录。
### Gitea API 创建镜像仓库(参考命令,凭据取自本机 GCM,勿回显)
```
POST /api/v1/repos/migrate
{
"clone_addr": "https://github.com/<org>/<repo>",
"repo_name": "<org>-<repo>",
"repo_owner": "VanuSystems-Mirror",
"mirror": true,
"private": true,
"description": "Mirror of <org>/<repo> (auto-sync from GitHub)",
"mirror_interval": "24h0m0s"
}
```
创建后检查 `mirror_interval` 是否生效(PATCH /api/v1/repos/{owner}/{repo} 可补设)。
注意:迁移完成前(repo 处于 migrating 状态)无法转移/删除仓库。
## 备用方案:本机脚本同步(仅当 Gitea 镜像不可用时)
`tools/sync-mirrors.ps1`(本机)或香港服务器 cron 方式,保持可用但**不再作为首选**:
GitHub → 本地裸镜像(mirrors/)→ `git push --mirror` → git.vanusys.com。
## 收录清单登记表
| 上游仓库 | 镜像地址 | 分类 | 同步方式 | 状态 |
|---------|---------|------|---------|------|
| https://github.com/facebook/astryx | git.vanusys.com/VanuSystems-Mirror/facebook-astryx | frontend | Gitea pull mirror(24h) | ✅ 已镜像 |