feat: 智币省初始版本 + PM2 部署配置

This commit is contained in:
Midas
2026-06-22 22:53:09 +08:00
commit 22a38eb9fb
11 changed files with 1497 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
# 智币省 - PM2 部署脚本
# 用法: ./deploy.sh
set -e
APP_DIR="/var/www/zhibisheng"
LOG_FILE="/var/log/zhibisheng-deploy.log"
echo "[$(date)] 开始部署智币省..." | tee -a $LOG_FILE
cd $APP_DIR || { echo "目录不存在: $APP_DIR"; exit 1; }
# 拉取最新代码
echo "[$(date)] 拉取最新代码..." | tee -a $LOG_FILE
git pull origin main
# 安装依赖
echo "[$(date)] 安装依赖..." | tee -a $LOG_FILE
npm install
# 重启 PM2
echo "[$(date)] 重启 PM2 服务..." | tee -a $LOG_FILE
pm2 stop zhibisheng 2>/dev/null || true
pm2 start ecosystem.config.js
pm2 save
# 验证服务状态
sleep 2
pm2 list
curl -s http://localhost:3000 > /dev/null && echo "[$(date)] ✅ 部署成功!" | tee -a $LOG_FILE || echo "[$(date)] ⚠️ 服务可能未正常启动" | tee -a $LOG_FILE