#!/bin/bash # sanguo_llmwiki Deployment Script # Deploys from development directory to installation directory set -e # Exit on error # Paths SRC_DIR="$HOME/.openclaw/sanguo_projects/sanguo_llmwiki" DST_DIR="$HOME/.sanguo_projects/sanguo_llmwiki" # Colors GREEN='\033[0;32m' NC='\033[0m' echo "Deploying sanguo_llmwiki..." echo "Source: $SRC_DIR" echo "Target: $DST_DIR" # Create target directory if it doesn't exist mkdir -p "$DST_DIR" # Deploy using rsync with exclusions rsync -av --delete \ --exclude='.git/' \ --exclude='.gitignore' \ --exclude='.claude/' \ --exclude='__pycache__/' \ --exclude='*.pyc' \ --exclude='.pytest_cache/' \ --exclude='.python-version' \ --exclude='.coverage' \ --exclude='.ruff_cache/' \ --exclude='tests/' \ --exclude='pytest.ini' \ --exclude='.env' \ --exclude='*.egg-info/' \ --exclude='dist/' \ --exclude='build/' \ --exclude='docs/' \ "$SRC_DIR/" "$DST_DIR/" echo -e "${GREEN}✓ Code deployed successfully${NC}" # Install dependencies using virtual environment echo "Setting up virtual environment..." cd "$DST_DIR" python3 -m venv .venv source .venv/bin/activate pip install --upgrade pip pip install -r requirements.txt echo -e "${GREEN}✓ Dependencies installed${NC}" # Update PM2 config to use virtual environment python (macOS sed syntax) sed -i '' "s|script: 'python3'|script: '$DST_DIR/.venv/bin/python'|g" ecosystem.config.cjs # Create necessary directories (use paths from ecosystem.config.cjs) mkdir -p "$HOME/.sanguo-llmwiki" mkdir -p "/Volumes/KnowledgeBase" echo -e "${GREEN}✓ Deployment complete!${NC}" echo "" echo "Next steps:" echo " 1. Test MCP Server: cd $DST_DIR && source .venv/bin/activate && python -m mcp_server.main" echo " 2. Start with PM2: pm2 start ecosystem.config.cjs"