3.8 KiB
3.8 KiB
生产服发布指南(ai30 手动部署)
面向本仓库的所有开发者。测试服流程见 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)
你需要记住的三件事
- push prod 不自动部署(与测试区最大差异)。生产环境人工卡点:把代码推上
prod 分支只是「发布候选」,必须到工作流页面手动点「运行工作流」才会真正发布
(发布纪律
standards://workflow/release@2.0.1:生产部署需人工触发)。 - 部署全自动:手动触发后由 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。 - 服务器配置不随代码走:
.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 已被占用) |
环境信息速查
| 项 | 值 |
|---|---|
| 生产服入口 | https://kb.well-trust.com(ai30 nginx 443 反代 8802;备选直连 http://192.168.100.230:8802) |
| 测试服入口 | https://kbt.well-trust.com(同一证书/vhost 反代 hxtesting 8801;备选 http://192.168.100.192:8801) |
| 代码仓库 | 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;回调登记 IP 与 https://kb.well-trust.com 两路 + localhost:5173;client 凭据存 Mac ~/dev-tools/aido-oidc-prod.txt(600) |
| Casdoor 改库备份 | ai30 shared-postgres casdoor_db.application_bak_20261119(注册应用行)、application_bak_20261120(域名回调更新前) |
| 数据落位 | ai30 Docker 数据根 /data/lib/docker(/data 卷,987G 可用) |
| 域名/证书 | kb+kbt SAN 一张(/data/ai-platform/.certbot/config/live/kb.well-trust.com/),DNS A 记录与 TXT 验证均走阿里 API(凭据 aliyun-welltrust.ini)自动完成,续期 dns-aliyun 全自动;vhost=/etc/nginx/conf.d/kb-academy.conf(预写件 /data/ai-platform/kb-academy-nginx.conf,装载需一次 sudo) |