# � DevOps YDeployment Guide - Yaltipia Telegram Bot ## 📋 **QUICK DEPLOYMENT CHECKLIST** ### **⚡ Pre-Deployment (5 minutes)** - [ ] **Clone repository** (exclude .env files) - [ ] **Install Node.js 16+** and npm - [ ] **Create production environment file** - [ ] **Set up process manager** (PM2 recommended) - [ ] **Configure firewall** (ports 3000, 3001) ### **🔒 Security Requirements (Critical)** - [ ] **Generate new bot token** in BotFather (never use development token) - [ ] **Use HTTPS URLs only** (no HTTP in production) - [ ] **Set strong admin chat IDs** - [ ] **Configure monitoring alerts** --- ## �️ *e*STEP-BY-STEP DEPLOYMENT** ### **1. 📦 Server Setup** ```bash # Install Node.js (Ubuntu/Debian) curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs # Install PM2 globally sudo npm install -g pm2 # Create application user sudo useradd -m -s /bin/bash yaltipia-bot sudo mkdir -p /opt/yaltipia-bot sudo chown yaltipia-bot:yaltipia-bot /opt/yaltipia-bot ``` ### **2. 📥 Application Deployment** ```bash # Switch to app user sudo su - yaltipia-bot # Clone repository cd /opt/yaltipia-bot git clone . # Install dependencies (production only) npm ci --only=production # Set proper permissions chmod 755 src/ chmod 644 package*.json ``` ### **3. 🔧 Environment Configuration** ```bash # Copy production template cp .env.production .env # Edit with production values nano .env ``` **Required Environment Variables:** ```env # CRITICAL: Replace with production values TELEGRAM_BOT_TOKEN=YOUR_PRODUCTION_BOT_TOKEN API_BASE_URL=https://your-production-api.com/api WEBSITE_URL=https://yaltipia.com # Notification System NOTIFICATION_MODE=optimized NOTIFICATION_CHECK_INTERVAL_HOURS=6 MAX_NOTIFICATIONS_PER_USER=3 SEND_NO_MATCH_NOTIFICATIONS=false # Monitoring (Replace with your admin chat) ADMIN_CHAT_IDS=YOUR_ADMIN_CHAT_ID MONITORING_TOPIC_ID=YOUR_TOPIC_ID HEALTH_CHECK_INTERVAL_MINUTES=30 DAILY_REPORT_HOUR=9 ERROR_CLEANUP_INTERVAL_HOURS=1 # Security NODE_ENV=production WEBHOOK_PORT=3001 ``` ### **4. 🔒 Security Hardening** ```bash # Set secure file permissions chmod 600 .env chmod 700 /opt/yaltipia-bot # Create systemd service (optional) sudo tee /etc/systemd/system/yaltipia-bot.service > /dev/null <