feat(deploy): gencode 纳入 server 发版产物 + EC2 生码封装

server 流水线编译并发布 jiu-gencode 二进制(回滚路径随 release 资产
自动下载),部署到 /opt/jiu/backend/,对旧版回滚做存在性判断优雅跳过。
新增 deploy/jiu-gencode.sh 封装自动读 production.env,线上生码从此
一条 ssh 即可,无需本地交叉编译 + scp。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2Wdwo7SmgBJU37cBrkhPK
This commit is contained in:
wangjia
2026-06-19 14:04:14 +08:00
parent 8fc24b5d36
commit 54451f0e52
4 changed files with 56 additions and 2 deletions
+18
View File
@@ -27,6 +27,13 @@ echo "==> deploy-server: uploading files to EC2"
${SCP} dist/jiu-server "${EC2_USER}@${EC2_HOST}:/tmp/jiu-server"
${SCP} /tmp/jiu-configs/deploy/nginx-jiu.conf "${EC2_USER}@${EC2_HOST}:/tmp/nginx-jiu.conf"
# Platform code-minting CLI + wrapper (absent when rolling back to a pre-gencode
# release — upload only when present).
if [ -f dist/jiu-gencode ]; then
${SCP} dist/jiu-gencode "${EC2_USER}@${EC2_HOST}:/tmp/jiu-gencode"
${SCP} /tmp/jiu-configs/deploy/jiu-gencode.sh "${EC2_USER}@${EC2_HOST}:/tmp/jiu-gencode.sh"
fi
${SSH} "${EC2_USER}@${EC2_HOST}" << 'ENDSSH'
set -e
@@ -35,6 +42,17 @@ sudo systemctl stop jiu
cp /tmp/jiu-server /opt/jiu/backend/jiu-server
chmod +x /opt/jiu/backend/jiu-server
# Refresh the code-minting CLI if shipped in this release (skip gracefully on
# rollback to a pre-gencode release). Not a service — just a host-side binary.
if [ -f /tmp/jiu-gencode ]; then
cp /tmp/jiu-gencode /opt/jiu/backend/jiu-gencode
chmod +x /opt/jiu/backend/jiu-gencode
if [ -f /tmp/jiu-gencode.sh ]; then
cp /tmp/jiu-gencode.sh /opt/jiu/backend/jiu-gencode.sh
chmod +x /opt/jiu/backend/jiu-gencode.sh
fi
fi
# Start and health check
sudo systemctl start jiu
echo "Waiting for health check..."