From 71f03f4125e32401f78f831aeaa5cf2f941a90a2 Mon Sep 17 00:00:00 2001 From: work-1 Date: Sun, 15 Feb 2026 14:31:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BF=AB=E9=80=9F=E5=90=AF?= =?UTF-8?q?=E5=8A=A8/=E5=81=9C=E6=AD=A2=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ stop.sh | 12 ++++++++++++ 2 files changed, 68 insertions(+) create mode 100755 start.sh create mode 100755 stop.sh diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..3ab1912 --- /dev/null +++ b/start.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +echo "🚀 启动多智能体任务管理系统..." + +# 检查 Docker 是否在运行 +if ! docker info > /dev/null 2>&1; then + echo "❌ Docker 未运行,请先启动 Docker" + exit 1 +fi + +# 停止并清理旧容器 +echo "清理旧容器..." +docker stop test-postgres 2>/dev/null || true +docker rm test-postgres 2>/dev/null || true + +# 启动 PostgreSQL +echo "启动 PostgreSQL..." +docker run -d \ + --name agent-task-postgres \ + --restart unless-stopped \ + -e POSTGRES_DB=agent_tasks \ + -e POSTGRES_USER=postgres \ + -e POSTGRES_PASSWORD=postgres \ + -p 5432:5432 \ + postgres:15-alpine + +# 等待数据库就绪 +echo "等待数据库启动..." +sleep 5 + +# 启动应用服务 +echo "启动应用服务..." +pkill -f "node.*server-postgres.js" || true +cd "$(dirname "$0")" +DB_HOST=localhost \ +DB_PORT=5432 \ +DB_PASSWORD=postgres \ +nohup node server-postgres.js > server.log 2>&1 & + +sleep 2 + +# 检查服务状态 +if curl -s http://localhost:3000/health > /dev/null; then + echo "" + echo "✅ 服务启动成功!" + echo "" + echo "🌐 Web 界面: http://localhost:3000" + echo "📡 API 地址: http://localhost:3000/api" + echo "📊 健康检查: http://localhost:3000/health" + echo "" + echo "📝 查看日志: tail -f server.log" + echo "🛑 停止服务: ./stop.sh" +else + echo "❌ 服务启动失败,请查看 server.log" + exit 1 +fi diff --git a/stop.sh b/stop.sh new file mode 100755 index 0000000..16c41fb --- /dev/null +++ b/stop.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +echo "🛑 停止多智能体任务管理系统..." + +# 停止 Node.js 服务 +pkill -f "node.*server-postgres.js" + +# 停止 PostgreSQL 容器 +docker stop agent-task-postgres 2>/dev/null +docker rm agent-task-postgres 2>/dev/null + +echo "✅ 服务已停止"