feat(mobile,deploy): 接入安卓极光与华为通道并准备公网部署配置

客户端默认指向 jxd.jinniu.ink 的 HTTPS/WSS;登录后把 OpenIM userID 设为极光 alias。
华为 agconnect-services.json 不伪造、不入库。Master Secret 只从服务器文件注入。

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
编码工程师
2026-08-30 21:32:58 +08:00
co-authored by multica-agent
parent f35e1f03d5
commit f1fe4a3928
35 changed files with 687 additions and 64 deletions
+66
View File
@@ -0,0 +1,66 @@
# 公网测试部署说明(jxd.jinniu.ink
施工员本卡**不执行**本节命令、不 SSH 改测试机。由总工审核通过后再部署。
目标机:已解析到 `jxd.jinniu.ink` 的香港测试服务器。数据目录仍是仓库下的 `components/``data/`,回滚不删数据。
## 对外暴露与对内绑定
| 入口 | 协议 | 后端 | 说明 |
| --- | --- | --- | --- |
| `https://jxd.jinniu.ink/` | HTTPS | OpenIM API `:10002` | 客户端 `apiAddr` |
| `wss://jxd.jinniu.ink/msg_gateway` | WSS | OpenIM 网关 `:10001` | 客户端 `wsAddr` |
| `https://jxd.jinniu.ink/account/` | HTTPS | 账号服务 `:10010` | 客户端 `authApiBase` |
| `https://jxd.jinniu.ink/files/` | HTTPS | MinIO `:10005` | `MINIO_EXTERNAL_ADDRESS` |
| `wss://jxd.jinniu.ink/livekit/` | WSS | LiveKit 信令 `:17880` | 客户端 `livekitUrl` |
| `:17881/tcp` `:17882/udp` | 媒体 | LiveKit RTC | 必须对公网开放,不能只走 443 |
内部端口(10001/10002/10005/10010/17880/etcd)在 overlay 里绑 `127.0.0.1`。防火墙建议只放行 80/tcp、443/tcp、17881/tcp、17882/udp。
## 证书
1. 先把 `deploy/public/nginx.bootstrap.conf` 挂到 edge(只听 80)。
2. `certbot certonly --webroot -w deploy/public/acme -d jxd.jinniu.ink`
3. 确认 `/etc/letsencrypt/live/jxd.jinniu.ink/``fullchain.pem``privkey.pem`
4. 改回 `nginx.conf` 后重载 edge。
私钥不得复制进 Git。
## 极光 Master Secret
文件在测试机 `/root/.config/jinxunda/jpush_master_secret`(权限 600)。部署前:
```bash
source ./scripts/load-jpush-secret.sh # 只导出环境变量,不打印内容
```
不要 `cat` 该文件,不要写进 `.env` 或 compose 明文。
## 启动(总工)
```bash
cd /path/to/tongxunruanjian
cp .env.example .env # 若还没有
# 按 deploy/public/.env.public.example 写入 SERVER_IP、MINIO_EXTERNAL_ADDRESS、JPUSH_*(不含 Master Secret
source ./scripts/load-jpush-secret.sh
./scripts/deploy-public.sh
```
`SERVER_IP` 填本机公网 IP(LiveKit 媒体候选),不要写进手机/电脑客户端代码。
## 回滚
```bash
./scripts/rollback-public.sh
```
效果:停掉 nginx edge,按原来的 `docker-compose.yaml` 拉起;`components/``data/account` 不动。
## 客户端地址(已写进代码默认值)
- 手机:`mobile/lib/config.dart`,默认 `jxd.jinniu.ink` + TLS。内网回切:`--dart-define=SERVER_HOST=192.168.200.11 --dart-define=USE_TLS=false`
- 电脑:改 `pc-client/.env``VITE_*``https://` / `wss://` 路径,见该目录 `.env.example`
## 华为通道缺口
`mobile/android/app/README-agconnect.md`。缺 `agconnect-services.json` 时华为真机厂商通道不通,其余施工已完成。