zizi 6814fa2a62 docs(ops): record proxy-ng deployment hardening
Add deployment traces for the JPpro proxy node, RackNerd origin hosts, catproxy boundary changes, local speed checks, and Sub2API rate-limit behavior.

Keep remote secrets excluded while tracking sanitized nginx, compose, plan, and operational memory documents.
2026-05-26 23:27:41 +08:00

115 lines
4.2 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.

# US RackNerd 0425 Sub2API Remote Inventory
最后核对时间2026-05-26 12:10 Asia/Shanghai
## 远程位置
- Tabby profile`个人-US-racknerd-0425-1c1g`
- Hostname`racknerd-042910c`
- 公网 IP`107.173.86.201`
- 当前公网入口:`https://pai.cyan2000.uk`
- 迁移后角色:旧机,短期回滚来源
- 部署目录:`/opt/sub2api`
- Compose project`sub2api`
- 系统:已验证为 Linux 服务器;本次未读取完整 `/etc/os-release`
## 本地留痕
- 当前远程 Compose 副本:`current/docker-compose.yml`
- 当前远程 nginx 站点副本:`current/nginx-sub2api.conf`
- 迁移包 SHA256 记录:`backups/migrate-to-racknerd-0526-20260525-205103.SHA256SUMS`
- 密钥目录说明:`secrets/README.md`
真实 `.env`、Mihomo 配置、订阅文件和临时备份不得提交。需要本地留存时放入 `secrets/``backups/`,并确认 `.gitignore` 已排除。
## 当前远程配置状态
- nginx 管理公网域名 `pai.cyan2000.uk`,证书由 Certbot 管理。
- nginx 配置路径:`/etc/nginx/sites-available/sub2api.conf`
- nginx 启用路径:`/etc/nginx/sites-enabled/sub2api.conf -> /etc/nginx/sites-available/sub2api.conf`
- Sub2API 只绑定宿主机 `127.0.0.1:8080`,由 nginx 反代公网 HTTPS。
- Docker Compose 使用本地目录持久化,不使用 Docker 命名卷。
- 运行目录包含:
- `/opt/sub2api/data`
- `/opt/sub2api/postgres_data`
- `/opt/sub2api/redis_data`
- `/opt/sub2api/mihomo`
- 当前容器:
- `sub2api``weishaw/sub2api:latest`healthy`127.0.0.1:8080->8080`
- `sub2api-postgres``postgres:18-alpine`healthy
- `sub2api-redis``redis:8-alpine`healthy
- `sub2api-mihomo``metacubex/mihomo:latest`
- 最新运行数据规模快照:
- `data`:约 70M
- `postgres_data`:约 201M
- `redis_data`:约 16M
- `mihomo`:约 44K
## 部署架构
```text
Browser :443 HTTPS -> nginx -> 127.0.0.1:8080 -> sub2api container
-> postgres container
-> redis container
-> mihomo container (account proxy)
```
公网只应暴露 `80/443/22``8080` 只监听 `127.0.0.1`PostgreSQL、Redis、Mihomo 不映射到公网。
## 迁移关系
这台服务器是已完成迁移的数据来源,并保留为短期回滚来源。目标服务器记录见:
```text
ops/remote/us-racknerd-0526-sub2api/
```
迁移时已优先迁移:
- PostgreSQL 数据:`/opt/sub2api/postgres_data` 或通过 `pg_dump` 导出。
- Redis 数据:`/opt/sub2api/redis_data`
- Sub2API 数据目录:`/opt/sub2api/data`
- Mihomo 配置:`/opt/sub2api/mihomo`
- 运行配置:`/opt/sub2api/docker-compose.yml``/opt/sub2api/.env`
- nginx 配置:`/etc/nginx/sites-available/sub2api.conf`,目标域名需改为 `proxy.api.lilifamily.com`
迁移包路径:
```text
/opt/sub2api/backups/migrate-to-racknerd-0526-20260525-205103/
```
## 运行检查
```bash
cd /opt/sub2api
docker compose ps
curl -sS http://127.0.0.1:8080/health
curl --noproxy '*' -sS https://pai.cyan2000.uk/health
systemctl status nginx --no-pager
```
期望结果:
- `sub2api``sub2api-postgres``sub2api-redis` 为 healthy。
- 本机 `/health` 返回 `{"status":"ok"}`
- 公网入口 `/health` 返回 `{"status":"ok"}`
## 操作记录
### 2026-05-26 迁移前盘点
- 通过 Tabby profile `个人-US-racknerd-0425-1c1g` 只读核对。
- 确认 `/opt/sub2api` 存在且 Docker Compose 服务健康。
- 确认 nginx 站点配置由 Certbot 管理 `pai.cyan2000.uk`
- 已将可提交的 Compose/nginx 配置副本写入 `current/`
### 2026-05-26 迁移备份与回滚状态
- 旧机生成迁移包:`/opt/sub2api/backups/migrate-to-racknerd-0526-20260525-205103/`
- 迁移包包含 PostgreSQL custom dump、运行配置和非日志运行数据归档、旧 nginx 配置、SHA256 校验文件。
- 旧机本地 `sha256sum -c SHA256SUMS` 校验通过。
- 迁移完成后只读复核:`sub2api``sub2api-postgres``sub2api-redis` 仍为 healthy`sub2api-mihomo` 仍为 running。
- 旧机本机 `/health` 返回 `{"status":"ok"}`
- 未执行停机或数据删除操作;如新机回滚失败,可继续使用旧域名 `https://pai.cyan2000.uk`