Back to list
MichaelMishaev

whatsapp-bot-deployment

by MichaelMishaev

WhatsApp Community Guard Bot using Baileys

1🍴 0📅 Jan 14, 2026

SKILL.md


name: whatsapp-bot-deployment description: Production deployment workflow for bCommGuard WhatsApp bot to VPS server tags: [deployment, ssh, pm2, production]

WhatsApp Bot Deployment Skill

This skill guides you through deploying bCommGuard to the production VPS server.

Server Information

  • IP: 209.38.231.184
  • User: root
  • Bot Path: /root/CommGuard/
  • Process Manager: PM2 (process name: commguard)

Pre-Deployment Checklist

  1. Test locally first:

    npm test
    node tests/comprehensiveQA.js
    
  2. Verify git status:

    git status
    git log -1  # Check latest commit
    
  3. Ensure changes are committed:

    • All changes must be committed to git
    • Push to GitHub (deployment is via GitHub)

Deployment Workflow

Step 1: SSH to Server

ssh root@209.38.231.184

Step 2: Navigate to Bot Directory

cd /root/CommGuard/

Step 3: Check Current Status

pm2 status
pm2 logs commguard --lines 20

Step 4: Pull Latest Changes

git pull origin main

Step 5: Install Dependencies (if package.json changed)

npm install

Step 6: Restart Bot

pm2 restart commguard

Step 7: Verify Deployment

# Check logs for errors
pm2 logs commguard --lines 50

# Check bot is running
pm2 status

# Monitor for 30 seconds
pm2 logs commguard --lines 0

Memory Protection Verification

After deployment, verify triple-layer memory protection:

# Check PM2 config
pm2 info commguard | grep -E 'cron|memory'

# Check swap space
swapon --show

# Check current memory usage
free -h

Expected output:

  • max_memory_restart: 400M
  • cron_restart: '0 0 * * *' (midnight daily)
  • Swap: 1G

Rollback Procedure

If deployment fails:

# Check previous commits
git log --oneline -5

# Rollback to previous commit
git reset --hard HEAD~1

# Restart bot
pm2 restart commguard

# Verify
pm2 logs commguard

Common Issues

Bot Not Starting

# Check auth files
ls -la baileys_auth_info/

# Clear auth and restart (requires QR scan)
rm -rf baileys_auth_info/
pm2 restart commguard

High Memory Usage

# Check memory
free -h
pm2 info commguard

# Force restart if needed
pm2 restart commguard

Port Already in Use

# Find process using port
lsof -i :3000

# Kill if needed
kill -9 <PID>

Post-Deployment Monitoring

Monitor for 5-10 minutes after deployment:

# Real-time logs
pm2 logs commguard

# Memory monitoring
watch -n 5 'free -h && pm2 info commguard | grep memory'

Critical Safety Rules

  • NEVER delete production database data
  • ALWAYS test locally before deploying
  • ALWAYS deploy via GitHub (never manual file edits)
  • VERIFY logs after deployment
  • MONITOR memory usage (960MB server limit)

Emergency Contacts

If critical issues occur:

  1. Check PM2 logs immediately
  2. Rollback if necessary
  3. Document the issue
  4. Test fix locally before redeploying

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon