2eb4275e6f
deploy-{server,site,client}.sh 目标主机参数化(DEPLOY_HOST/USER/SSH_KEY),
不传时行为与现状完全一致(只发 EC2)。workflow 的 Deploy 拆成 EC2(前)+
Ali(后,if:always + continue-on-error,影子目标失败不挡线上)。deploy-server
的 ali 分支只换二进制 + reload 独立 nginx(listen 443),不启动 jiu(阿里 DB
为只读从库,切流提升为主后才起)。新增 deploy/nginx-jiu-ali.conf 并打进
configs.tar.gz。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
39 lines
1.2 KiB
Bash
39 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
# compile-backend.sh <tag> — build the Linux backend binary + shared-infra
|
|
# configs.tar.gz into dist/. Server pipeline (server-v*). Does NOT touch
|
|
# version.yaml (that is client-owned) nor any Flutter/web artifact.
|
|
set -euo pipefail
|
|
|
|
# shellcheck source=scripts/ci/_env.sh
|
|
. "$(dirname "$0")/_env.sh"
|
|
|
|
TAG="$1"
|
|
echo "==> compile-backend: tag=${TAG}"
|
|
|
|
# Build Go backend (linux/amd64 for EC2)
|
|
cd backend
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o jiu-server .
|
|
# Platform code-minting CLI (gencode) ships alongside the server so codes can be
|
|
# minted on EC2 without cross-compiling/scp each time.
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o jiu-gencode ./cmd/gencode
|
|
cd ..
|
|
|
|
mkdir -p dist
|
|
mv backend/jiu-server dist/jiu-server
|
|
mv backend/jiu-gencode dist/jiu-gencode
|
|
|
|
# Shared infrastructure (nginx/systemd/env/compose). version.yaml is NOT here —
|
|
# it belongs to the client pipeline.
|
|
tar -czf dist/configs.tar.gz \
|
|
deploy/nginx-jiu.conf \
|
|
deploy/nginx-jiu-ali.conf \
|
|
deploy/jiu.service \
|
|
deploy/production.env.template \
|
|
deploy/setup-ec2.sh \
|
|
deploy/docker-compose.yml \
|
|
deploy/docker-compose.jiu.yml \
|
|
deploy/jiu-gencode.sh
|
|
|
|
echo "==> compile-backend: done — dist/ contents:"
|
|
ls -lh dist/
|