first commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# 知命阁(zhimingge)服务器更新脚本
|
||||
# 用法:cd /opt/zhimingge && bash scripts/deploy.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
APP_DIR="/opt/zhimingge"
|
||||
APP_NAME="zhimingge"
|
||||
|
||||
cd "$APP_DIR"
|
||||
|
||||
echo "==> 拉取最新代码..."
|
||||
git pull origin main
|
||||
|
||||
echo "==> 安装依赖..."
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
echo "==> 生产构建..."
|
||||
pnpm run build
|
||||
|
||||
echo "==> 确保日志目录存在..."
|
||||
mkdir -p logs
|
||||
|
||||
echo "==> 重启 PM2..."
|
||||
pm2 restart "$APP_NAME" || pm2 start ecosystem.config.cjs
|
||||
|
||||
echo "==> 部署完成"
|
||||
pm2 status "$APP_NAME"
|
||||
curl -s -o /dev/null -w "HTTP %{http_code}\n" http://127.0.0.1:3000 || true
|
||||
Reference in New Issue
Block a user