From 093fb80c1df11c46f7b51422549b32245196d51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Sun, 8 Mar 2026 18:15:47 +0800 Subject: [PATCH] =?UTF-8?q?sync:=20=E8=84=9A=E6=9C=AC=E4=B8=8E=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20|=20=E5=8E=9F=E5=9B=A0:=20=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=88=96=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/本地启动.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scripts/本地启动.sh diff --git a/scripts/本地启动.sh b/scripts/本地启动.sh new file mode 100644 index 00000000..0929f7d5 --- /dev/null +++ b/scripts/本地启动.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# 本地启动:后端 + 前端,前后端接口均在本地 +# 用法:./scripts/本地启动.sh 或 bash scripts/本地启动.sh + +set -e +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$ROOT" + +# 1. 启动 soul-api(需先编译 Mac 版:go build -o soul-api-mac ./cmd/server) +echo "===== 1. 启动 soul-api(端口 8080)=====" +if [ ! -f soul-api/soul-api-mac ]; then + echo "未找到 soul-api-mac,正在编译..." + (cd soul-api && go build -o soul-api-mac ./cmd/server) +fi +APP_ENV=development PORT=8080 "$ROOT/soul-api/soul-api-mac" & +API_PID=$! +echo "soul-api 已启动 PID=$API_PID" +sleep 3 + +# 2. 健康检查 +if ! curl -sf http://localhost:8080/health >/dev/null; then + echo "soul-api 启动失败,请检查数据库连接" + kill $API_PID 2>/dev/null || true + exit 1 +fi +echo "soul-api 健康检查通过" + +# 3. 启动 soul-admin +echo "" +echo "===== 2. 启动 soul-admin(端口 5174)=====" +echo "访问 http://localhost:5174 默认账号 admin / admin123" +cd soul-admin && pnpm dev