Add deployment scripts and documentation
- Add deployment scripts (deploy.sh, test_connection.sh, core/start_server.sh) - Add deployment documentation (DEPLOYMENT_INFO.md, DEPLOYMENT_SUCCESS.md) - Add .env.example configuration template - Add requirements.txt for Python dependencies - Update README.md with latest information - Update core/server.py with improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
77
deploy.sh
Executable file
77
deploy.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
# Funstat MCP 服务器部署脚本
|
||||
|
||||
set -e
|
||||
|
||||
SERVER_IP="172.16.74.159"
|
||||
SERVER_USER="atai"
|
||||
SERVER_PATH="/home/atai/funstat-mcp"
|
||||
LOCAL_PATH="/Users/hahaha/projects/funstat-mcp"
|
||||
|
||||
echo "🚀 开始部署 Funstat MCP 到服务器..."
|
||||
|
||||
# 1. 打包项目文件(排除不需要的文件)
|
||||
echo "📦 打包项目文件..."
|
||||
cd "$LOCAL_PATH"
|
||||
tar --exclude='.git' \
|
||||
--exclude='.venv' \
|
||||
--exclude='__pycache__' \
|
||||
--exclude='*.pyc' \
|
||||
--exclude='.DS_Store' \
|
||||
--exclude='customer_data' \
|
||||
-czf /tmp/funstat-mcp.tar.gz .
|
||||
|
||||
# 2. 上传到服务器
|
||||
echo "⬆️ 上传文件到服务器..."
|
||||
sshpass -p "wengewudi666808" scp /tmp/funstat-mcp.tar.gz ${SERVER_USER}@${SERVER_IP}:/tmp/
|
||||
|
||||
# 3. 在服务器上部署
|
||||
echo "🔧 在服务器上部署..."
|
||||
sshpass -p "wengewudi666808" ssh ${SERVER_USER}@${SERVER_IP} << 'ENDSSH'
|
||||
set -e
|
||||
|
||||
# 创建部署目录
|
||||
mkdir -p /home/atai/funstat-mcp
|
||||
cd /home/atai/funstat-mcp
|
||||
|
||||
# 停止旧服务
|
||||
echo "🛑 停止旧服务..."
|
||||
pkill -f "funstat.*server.py" 2>/dev/null || true
|
||||
sleep 2
|
||||
|
||||
# 解压新文件
|
||||
echo "📂 解压新文件..."
|
||||
tar -xzf /tmp/funstat-mcp.tar.gz -C /home/atai/funstat-mcp
|
||||
rm /tmp/funstat-mcp.tar.gz
|
||||
|
||||
# 创建虚拟环境(如果不存在)
|
||||
if [ ! -d ".venv" ]; then
|
||||
echo "🔨 创建虚拟环境..."
|
||||
python3 -m venv .venv
|
||||
fi
|
||||
|
||||
# 激活虚拟环境并安装依赖
|
||||
echo "📥 安装依赖..."
|
||||
source .venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
# 创建 session 目录
|
||||
mkdir -p ~/telegram_sessions
|
||||
|
||||
# 检查 session 文件
|
||||
if [ ! -f ~/telegram_sessions/funstat_bot.session ]; then
|
||||
echo "⚠️ 警告: Session 文件不存在"
|
||||
echo "请确保已经上传 session 文件到 ~/telegram_sessions/funstat_bot.session"
|
||||
fi
|
||||
|
||||
echo "✅ 部署完成!"
|
||||
echo "启动服务: cd /home/atai/funstat-mcp/core && bash start_server.sh"
|
||||
ENDSSH
|
||||
|
||||
echo ""
|
||||
echo "✅ 部署完成!"
|
||||
echo "下一步:"
|
||||
echo "1. 确保 session 文件已上传到服务器: ~/telegram_sessions/funstat_bot.session"
|
||||
echo "2. SSH 到服务器: ssh atai@172.16.74.159"
|
||||
echo "3. 启动服务: cd /home/atai/funstat-mcp/core && bash start_server.sh"
|
||||
Reference in New Issue
Block a user