refactor: 改用 start.sh 直接部署,去掉 docker compose

This commit is contained in:
cheney
2026-08-31 15:05:44 +08:00
parent f58970783f
commit 2422ae452b
3 changed files with 28 additions and 99 deletions
+13 -8
View File
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
# Awesome Index 启动脚本
# Awesome Index 启动脚本(直接部署,不使用 Docker)
DEPLOY_PATH="$(cd "$(dirname "$0")" && pwd)"
cd "$DEPLOY_PATH"
@@ -11,17 +11,22 @@ if [ ! -f .env ]; then
exit 1
fi
# 停止旧容器
echo "停止旧容器..."
docker compose down --remove-orphans 2>/dev/null || true
# 安装依赖
echo "安装依赖..."
npm ci --omit=dev --no-audit --no-fund
# 启动新容器
# 停止旧进程
echo "停止旧进程..."
pkill -f "node src/index.js" 2>/dev/null || true
sleep 1
# 启动服务
echo "启动 Awesome Index..."
docker compose up -d
nohup node src/index.js > logs/app.log 2>&1 &
# 健康检查
echo "等待服务就绪..."
sleep 5
sleep 2
MAX_RETRIES=10
RETRY_COUNT=0
@@ -37,5 +42,5 @@ while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
sleep 2
done
echo "✗ 服务启动失败,请检查日志: docker compose logs"
echo "✗ 服务启动失败,请检查日志: tail -50 logs/app.log"
exit 1