Files
ai_academy/docs/deploy-ai30.md
T

52 lines
3.3 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.
# 生产服发布指南(ai30 手动部署)
> 面向本仓库的所有开发者。测试服流程见 [deploy-hxtesting.md](deploy-hxtesting.md);
> 完整原理(runner 装法、踩坑、复建)见平台知识库
> `sy-platform-knowledge/docs/ai-academy-gitea-actions自动部署指南.md`(生产侧照搬同构)。
## 一图流
```
发布准备:git checkout prod
git merge main ← 或从已验证的 test 内容合入
git push origin prod ← 只进分支,不触发部署
生产发布:Gitea → 仓库 → 工作流 → deploy-ai30 → 「运行工作流」(选 prod 分支)
观察结果:工作流 tab 绿✅即发布完成(约 5-30 分钟,首次构建较慢)
访问验证:http://192.168.100.230:8802 ← 工号 + 密码登录(正式 Casdoor auth.well-trust.com)
```
## 你需要记住的三件事
1. **push prod 不自动部署(与测试区最大差异)**。生产环境人工卡点:把代码推上
prod 分支只是「发布候选」,必须到工作流页面手动点「运行工作流」才会真正发布
(发布纪律 `standards://workflow/release@2.0.1`:生产部署需人工触发)。
2. **部署全自动**:手动触发后由 ai30 宿主 runner(label=deploy-ai30)构建镜像并
compose up;失败点开红色运行记录看日志。回滚:ssh ai30 后
`docker tag wechatopenai/weknora-app:sha-<旧hash> wechatopenai/weknora-app:latest`
(ui 同理)→ `cd /data/ai-platform/ai_academy && docker compose up -d app frontend`。
3. **服务器配置不随代码走**:`.env`(端口、数据库、正式 Casdoor 接入等)由部署管理员
维护在 ai30 `/data/ai-platform/ai_academy/.env`(gitignored)。需要改配置找管理员。
## 与测试区的差异速查
| 项 | 测试区(hxtesting) | 生产区(ai30) |
| --- | --- | --- |
| 入口 | http://192.168.100.192:8801 | http://192.168.100.230:8802 |
| 触发 | push `test` 分支即部署 | 手动运行 deploy-ai30 工作流 |
| 工作流 | `.gitea/workflows/deploy-hxtesting.yml` | `.gitea/workflows/deploy-ai30.yml` |
| runner | hxtesting 宿主 lisq 用户(deploy-host) | ai30 宿主 inspur 用户(deploy-ai30,linger 常驻) |
| 认证 | 测试 Casdoor `autht.well-trust.com` | 正式 Casdoor `auth.well-trust.com`(应用 ai-academy) |
| 工作目录 | `~/services/ai_academy` | `/data/ai-platform/ai_academy` |
| 端口登记 | 8801(登记册 88xx 段) | 8802(app 容器仅回环 127.0.0.1:18080,宿主 8080 已被占用) |
## 环境信息速查
| 项 | 值 |
| --- | --- |
| 生产服入口 | http://192.168.100.230:8802(域名绑定待 DNS 管理员登记后更新) |
| 代码仓库 | http://192.168.100.230:3000/szsy_organization/ai_academy |
| 部署机 runner | `ssh ai30 'systemctl --user status gitea-runner'`(inspur,Linger=yes 开机自启) |
| 认证 | 正式 Casdoor `auth.well-trust.com`;回调登记 `http://192.168.100.230:8802/api/v1/auth/oidc/callback`(域名定稿后同步追加域名回调);client 凭据存 Mac `~/dev-tools/aido-oidc-prod.txt`(600) |
| Casdoor 改库备份 | ai30 shared-postgres `casdoor_db.application_bak_20261119`(注册应用行前快照) |
| 数据落位 | ai30 Docker 数据根 `/data/lib/docker`(/data 卷,987G 可用) |