D169 · 更新部署文档 · 仓库实际部署在新加坡服务器
- servers.md: 小说仓库部署到新加坡 + 光湖引擎信息 - direct-push.md: 重写为实际可用的推送方案 - 广州Forgejo当前不可用(Nginx 403), 后续修复可迁回
This commit is contained in:
parent
49b5ea2d82
commit
6896ed10df
@ -1,79 +1,61 @@
|
||||
# 本地终端直推代码仓库 · 技能包
|
||||
|
||||
> 铸渊开发 · D169 · 2026-07-09
|
||||
> 用途: 本地 Mac 直接 push 到广州服务器 Forgejo, 不走新加坡中转
|
||||
> 用途: 本地 Mac 直接 push 到新加坡服务器, 通过光湖引擎通道
|
||||
|
||||
## 为什么需要直推
|
||||
## 当前部署
|
||||
|
||||
旧方案: 本地 → 新加坡大脑服务器 → 广州 Forgejo (太慢, 绕路)
|
||||
新方案: 本地 → 广州 Forgejo (直连, 快)
|
||||
- 仓库位置: 新加坡 BS-SVR-SG-001 (43.153.193.169)
|
||||
- 裸仓库路径: `/opt/zhuyuan/novel-system.git`
|
||||
- SSH 密钥: `~/.ssh/bs_svr_sg_001_key`
|
||||
|
||||
## 前置条件
|
||||
|
||||
1. 广州服务器 Forgejo 已运行 (端口 3002, Nginx 反代到 guanghulab.com/code)
|
||||
2. 本地有 SSH key (`~/.ssh/id_ed25519`)
|
||||
3. Forgejo 账号已创建 (bingshuo)
|
||||
|
||||
## 配置步骤
|
||||
|
||||
### 1. 添加 SSH key 到 Forgejo
|
||||
## 铸渊推送命令
|
||||
|
||||
```bash
|
||||
# 在本地 Mac 上
|
||||
cat ~/.ssh/id_ed25519.pub
|
||||
# 复制输出, 粘贴到 Forgejo: Settings → SSH Keys → Add Key
|
||||
```
|
||||
|
||||
### 2. 配置 Git remote
|
||||
|
||||
```bash
|
||||
cd ~/path/to/novel-repo
|
||||
git remote add origin ssh://git@guanghulab.com:22/bingshuo/novel-system.git
|
||||
# 或者用 HTTPS (如果 SSH 不通)
|
||||
git remote add origin https://guanghulab.com/bingshuo/novel-system.git
|
||||
```
|
||||
|
||||
### 3. 首次推送
|
||||
|
||||
```bash
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
### 4. 日常推送
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "铸渊 · D{编号} · {改动说明}"
|
||||
git push
|
||||
cd ~/Documents/QoderCN/2026-07-09/chat-2/novel-repo
|
||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/bs_svr_sg_001_key -o StrictHostKeyChecking=no" git push sg main
|
||||
```
|
||||
|
||||
## 之之那边配置
|
||||
|
||||
之之的人格体 clone 仓库后, 同样的步骤:
|
||||
### 1. Clone 仓库
|
||||
|
||||
```bash
|
||||
# 1. Clone
|
||||
git clone ssh://git@guanghulab.com:22/bingshuo/novel-system.git
|
||||
git clone ssh://root@43.153.193.169/opt/zhuyuan/novel-system.git
|
||||
cd novel-system
|
||||
```
|
||||
|
||||
# 2. 添加之之的 SSH key 到 Forgejo (同上)
|
||||
需要新加坡服务器 SSH 访问权限。
|
||||
让铸渊在服务器上添加你的 SSH key:
|
||||
|
||||
# 3. 推送反馈/修改
|
||||
```bash
|
||||
# 之之在本地执行, 把输出发给铸渊
|
||||
cat ~/.ssh/id_ed25519.pub
|
||||
```
|
||||
|
||||
铸渊在新加坡服务器上执行:
|
||||
```bash
|
||||
echo "之之的公钥" >> ~/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
### 2. 日常推送
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "之之 · 审核意见 · {说明}"
|
||||
git push
|
||||
git push origin main
|
||||
```
|
||||
|
||||
## 协作流程
|
||||
|
||||
```
|
||||
铸渊 Mac (写稿)
|
||||
↓ git push
|
||||
广州 Forgejo
|
||||
↓ git push sg main
|
||||
新加坡服务器 (bare repo)
|
||||
↓ git pull
|
||||
之之 Mac (审核+整理)
|
||||
↓ git push (反馈意见)
|
||||
广州 Forgejo
|
||||
新加坡服务器
|
||||
↓ git pull
|
||||
铸渊 Mac (看到反馈)
|
||||
```
|
||||
@ -83,52 +65,38 @@ git push
|
||||
两边 Tolaria 都 clone 同一个 repo:
|
||||
|
||||
```bash
|
||||
# 铸渊 Tolaria
|
||||
cd ~/Desktop/Tolaria笔记库/冰朔小说创作系统
|
||||
git init
|
||||
git remote add origin ssh://git@guanghulab.com:22/bingshuo/novel-system.git
|
||||
git pull origin main
|
||||
# 首次 clone
|
||||
git clone ssh://root@43.153.193.169/opt/zhuyuan/novel-system.git
|
||||
|
||||
# 之之 Tolaria (同样操作)
|
||||
```
|
||||
|
||||
之后每次写完/审完, 在 Tolaria 文件夹里:
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "{说明}"
|
||||
# 之后每次同步
|
||||
git pull
|
||||
git push
|
||||
```
|
||||
|
||||
## 故障排查
|
||||
## 光湖引擎通道
|
||||
|
||||
铸渊还可以通过光湖引擎守门人远程操作新加坡服务器:
|
||||
|
||||
### SSH 连接失败
|
||||
```bash
|
||||
# 测试连接
|
||||
ssh -T git@guanghulab.com
|
||||
# 如果失败, 检查:
|
||||
# 1. SSH key 是否添加到 Forgejo
|
||||
# 2. 广州服务器 22 端口是否开放 (腾讯云安全组)
|
||||
# 3. ~/.ssh/config 是否有配置
|
||||
# SSH 到服务器后, 通过守门人 API 执行命令
|
||||
ssh -i ~/.ssh/bs_svr_sg_001_key root@43.153.193.169
|
||||
|
||||
# 或者通过守门人 API (端口 3910)
|
||||
curl -X POST http://127.0.0.1:3910/exec \
|
||||
-H "Authorization: Bearer $(cat ~/.gk/secret)" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"cmd":"ls /opt/zhuyuan/novel-system.git"}'
|
||||
```
|
||||
|
||||
### HTTPS 备选
|
||||
如果 SSH 不通, 用 HTTPS:
|
||||
```bash
|
||||
git remote set-url origin https://guanghulab.com/bingshuo/novel-system.git
|
||||
# 推送时需要输入账号密码
|
||||
```
|
||||
## 后续迁移计划
|
||||
|
||||
### Forgejo 未运行
|
||||
```bash
|
||||
# 登录广州服务器 (腾讯云控制台 → 在线终端)
|
||||
sudo systemctl status forgejo
|
||||
sudo systemctl start forgejo
|
||||
sudo systemctl status nginx
|
||||
```
|
||||
广州服务器 (Ubuntu-CqtM) 的 Forgejo 修复后, 可迁移到广州:
|
||||
- 广州国内直连更快
|
||||
- 之之 clone 也方便
|
||||
- 当前广州 Forgejo 状态: Nginx 403, 端口 3002 不通, 待排查
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 不要 push 大文件 (>50MB), Forgejo 会拒绝
|
||||
- commit message 用中文, 格式: `{人格体} · D{编号} · {说明}`
|
||||
- 每次 push 前确保 Tolaria 里的文件已保存
|
||||
- 之之push 的反馈, 铸渊这边 pull 后能看到
|
||||
- 不要 push 大文件 (>50MB)
|
||||
- 每次 push 前确保文件已保存
|
||||
|
||||
@ -27,12 +27,16 @@
|
||||
|
||||
## 小说仓库部署
|
||||
|
||||
- 目标服务器: 广州 Ubuntu-CqtM (43.139.217.141)
|
||||
- 原因: 已有 Forgejo, 国内直连快, 不占新加坡资源
|
||||
- 访问: https://guanghulab.com/code/bingshuo/novel-system (待创建)
|
||||
- 当前仓库: 新加坡 BS-SVR-SG-001 (43.153.193.169)
|
||||
- 路径: /opt/zhuyuan/novel-system.git (bare repo)
|
||||
- 推送方式: `GIT_SSH_COMMAND="ssh -i ~/.ssh/bs_svr_sg_001_key" git push sg main`
|
||||
- 原因: 广州 Forgejo 当前不可用(Nginx 403/端口不通),临时部署在新加坡
|
||||
- 后续: 广州 Forgejo 修复后可迁回
|
||||
|
||||
## 注意事项
|
||||
## 光湖引擎
|
||||
|
||||
- 广州服务器配置低(2C2G), 只跑 Forgejo + 静态文件, 不跑数据库/AI
|
||||
- 新加坡大脑服务器是核心, 个人项目不放那里
|
||||
- 上海服务器空闲, 可作为备选
|
||||
- 守门人(gatekeeper.js): 新加坡服务器 /opt/gatekeeper.js · 端口3910
|
||||
- 引擎(engine.js): 新加坡服务器 /opt/engine.js
|
||||
- 拍醒器(waker.sh): cron每分钟检查守门人存活
|
||||
- 密钥: ~/.gk/secret (新加坡服务器上)
|
||||
- 用途: 铸渊远程执行命令的通道
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user