Compare commits
19
Commits
3a578153bb
...
27c4d96ae1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27c4d96ae1 | ||
|
|
3f680882c8 | ||
|
|
a27d58560b | ||
|
|
3a20abc492 | ||
|
|
db5ca7790d | ||
|
|
0d5afe1193 | ||
|
|
e0e2a0e7c3 | ||
|
|
b328f83244 | ||
|
|
c7fe475545 | ||
|
|
3bc62a5acb | ||
|
|
89392b0fa4 | ||
|
|
a29ed6ff24 | ||
|
|
035edaf3fe | ||
|
|
746ecfaa34 | ||
|
|
04e93935a5 | ||
|
|
5f491edff4 | ||
|
|
d03e024d59 | ||
|
|
9058149576 | ||
|
|
9097ee699d |
No files matched your search
@@ -0,0 +1,61 @@
|
||||
# ai30 生产服自动部署
|
||||
# 触发:仅手动(workflow_dispatch)——生产环境人工卡点,push prod 不自动部署。
|
||||
# (发布纪律 standards://workflow/release@2.0.1:生产部署需人工触发;
|
||||
# 测试区走 deploy-hxtesting.yml 的 push test 触发,两者分工见 docs/deploy-hxtesting.md)
|
||||
# 执行:ai30 宿主上的 gitea-runner(label=deploy-ai30,host 模式,inspur 用户)
|
||||
# 说明:与 deploy-hxtesting 同构,差异三点——分支 prod、端口 8802、目标机 x86_64;
|
||||
# 端口登记:8801=测试(hxtesting) / 8802=生产(ai30),均属 88xx 平台 Web 号段。
|
||||
# 构建前产物 artifacts/ 与 .env 均为 gitignored,由部署管理员在 ai30 维护。
|
||||
name: deploy-ai30
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: deploy-ai30
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
DEPLOY_DIR: /data/ai-platform/ai_academy
|
||||
steps:
|
||||
- name: 同步代码
|
||||
run: |
|
||||
set -e
|
||||
cd "$DEPLOY_DIR"
|
||||
git fetch origin
|
||||
git checkout -q -B prod origin/prod
|
||||
echo "GIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
|
||||
echo "当前部署提交: $(git log --oneline -1)"
|
||||
|
||||
- name: 构建镜像(app + frontend,x86_64 原生)
|
||||
run: |
|
||||
set -e
|
||||
cd "$DEPLOY_DIR"
|
||||
# WITH_ANYDOC=0:跳过 anydoc 解析引擎(Rust 工具链需外网;文档解析由 docreader 容器承担)
|
||||
WITH_ANYDOC=0 bash scripts/build_images.sh -p
|
||||
WITH_ANYDOC=0 bash scripts/build_images.sh -f
|
||||
docker tag wechatopenai/weknora-app:latest wechatopenai/weknora-app:sha-${GIT_SHA}
|
||||
docker tag wechatopenai/weknora-ui:latest wechatopenai/weknora-ui:sha-${GIT_SHA}
|
||||
# 仅清理本项目旧版本镜像(保留最近 5 个 sha-* 备回滚),不影响 ai30 上其他项目
|
||||
for repo in wechatopenai/weknora-app wechatopenai/weknora-ui; do
|
||||
docker images --format '{{.Tag}}' "$repo" | grep '^sha-' | tail -n +6 \
|
||||
| xargs -r -I{} docker rmi "$repo:{}" >/dev/null 2>&1 || true
|
||||
done
|
||||
|
||||
- name: 部署(compose up)
|
||||
run: |
|
||||
set -e
|
||||
cd "$DEPLOY_DIR"
|
||||
docker compose up -d --remove-orphans
|
||||
|
||||
- name: 健康检查
|
||||
run: |
|
||||
set -e
|
||||
sleep 20
|
||||
if curl -fsS -o /dev/null --max-time 10 http://127.0.0.1:8802/; then
|
||||
echo "WEB_OK: http://ai30:8802/ 已可访问 (sha-${GIT_SHA})"
|
||||
else
|
||||
echo "健康检查失败,容器状态:"
|
||||
cd "$DEPLOY_DIR" && docker compose ps
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,61 @@
|
||||
# hxtesting 测试服自动部署
|
||||
# 触发:push 到 test 分支(按平台发布纪律:合并 main→test 即一次发布决定),也支持手动触发
|
||||
# 执行:hxtesting 宿主上的 gitea-runner(label=deploy-host,host 模式)
|
||||
# 说明:构建 app/frontend 镜像并顶替同名 latest tag,docreader/sandbox 等沿用官方镜像;
|
||||
# 每次构建额外打 sha-<短提交> tag 便于回滚。
|
||||
name: deploy-hxtesting
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [test]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: deploy-host
|
||||
timeout-minutes: 40
|
||||
env:
|
||||
DEPLOY_DIR: /home/lisq/services/ai_academy
|
||||
steps:
|
||||
- name: 同步代码
|
||||
run: |
|
||||
set -e
|
||||
cd "$DEPLOY_DIR"
|
||||
git fetch origin
|
||||
git checkout -q -B test origin/test
|
||||
echo "GIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
|
||||
echo "当前部署提交: $(git log --oneline -1)"
|
||||
|
||||
- name: 构建镜像(app + frontend,ARM64 原生)
|
||||
run: |
|
||||
set -e
|
||||
cd "$DEPLOY_DIR"
|
||||
# WITH_ANYDOC=0:跳过 anydoc 解析引擎(Rust 工具链需外网,hxtesting 不可达;
|
||||
# 文档解析由 docreader 容器承担,测试环境不受影响)
|
||||
WITH_ANYDOC=0 bash scripts/build_images.sh -p
|
||||
WITH_ANYDOC=0 bash scripts/build_images.sh -f
|
||||
docker tag wechatopenai/weknora-app:latest wechatopenai/weknora-app:sha-${GIT_SHA}
|
||||
docker tag wechatopenai/weknora-ui:latest wechatopenai/weknora-ui:sha-${GIT_SHA}
|
||||
# 仅清理本项目旧版本镜像(保留最近 5 个 sha-* 备回滚),不影响服务器上其他项目
|
||||
for repo in wechatopenai/weknora-app wechatopenai/weknora-ui; do
|
||||
docker images --format '{{.Tag}}' "$repo" | grep '^sha-' | tail -n +6 \
|
||||
| xargs -r -I{} docker rmi "$repo:{}" >/dev/null 2>&1 || true
|
||||
done
|
||||
|
||||
- name: 部署(compose up)
|
||||
run: |
|
||||
set -e
|
||||
cd "$DEPLOY_DIR"
|
||||
docker compose up -d --remove-orphans
|
||||
|
||||
- name: 健康检查
|
||||
run: |
|
||||
set -e
|
||||
sleep 20
|
||||
if curl -fsS -o /dev/null --max-time 10 http://127.0.0.1:8801/; then
|
||||
echo "WEB_OK: http://hxtesting:8801/ 已可访问 (sha-${GIT_SHA})"
|
||||
else
|
||||
echo "健康检查失败,容器状态:"
|
||||
cd "$DEPLOY_DIR" && docker compose ps
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,51 @@
|
||||
# 生产服发布指南(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 可用) |
|
||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Reference in new issue
Block a user