Initial commit: HealthCarePregnant project documentation and platform

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
selfrelease
2026-06-18 09:48:05 +08:00
commit eab91174db
301 changed files with 42491 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# PCM 一键部署到 staging:构建镜像 → 启动 → 等待后端健康 → 探活前端
# 用法:AUTH_SECRET=xxx ./scripts/deploy-staging.sh
set -euo pipefail
cd "$(dirname "$0")/.."
COMPOSE="docker compose"
BACKEND_PORT="${BACKEND_PORT:-3000}"
PATIENT_PORT="${PATIENT_PORT:-8081}"
ADMIN_PORT="${ADMIN_PORT:-8082}"
FAMILY_PORT="${FAMILY_PORT:-8083}"
echo "[1/4] 构建并启动服务…"
$COMPOSE up -d --build
echo "[2/4] 等待后端健康检查通过…"
for i in $(seq 1 30); do
if curl -fsS "http://localhost:${BACKEND_PORT}/api/health" >/dev/null 2>&1; then
echo " 后端就绪。"
break
fi
if [ "$i" -eq 30 ]; then
echo " 后端在超时时间内未就绪。" >&2
$COMPOSE logs backend >&2 || true
exit 1
fi
sleep 2
done
echo "[3/4] 探活前端…"
for entry in "孕妇端:${PATIENT_PORT}" "医护/运营端:${ADMIN_PORT}" "家属端:${FAMILY_PORT}"; do
name="${entry%%:*}"; port="${entry##*:}"
code=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:${port}/" || echo 000)
echo " ${name} (:${port}) → HTTP ${code}"
done
echo "[4/4] 部署完成。访问:"
echo " 后端 API: http://localhost:${BACKEND_PORT}/api/health"
echo " 孕妇端: http://localhost:${PATIENT_PORT}/"
echo " 医护/运营端: http://localhost:${ADMIN_PORT}/"
echo " 家属端: http://localhost:${FAMILY_PORT}/"