#!/bin/bash # Deployment Instructions for Shared Hosting (klikcell.com) cat << 'EOF' ╔══════════════════════════════════════════════════════════════════╗ ║ SHARED HOSTING DEPLOYMENT CHECKLIST ║ ║ For: api.kitonga.klikcell.com ║ ╚══════════════════════════════════════════════════════════════════╝ 📋 YOUR HOSTING INFORMATION: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Hosting: klikcell.com (Shared cPanel) • Username: thebkihw • Server IP: 162.0.215.155 • Your IP: 162.0.215.152 • Home Dir: /home/thebkihw • Control Panel: https://klikcell.com:2083 ⚠️ IMPORTANT: Shared hosting CANNOT connect to your local MikroTik router! Solution: Enable Mock Mode (router features disabled but API works) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ DEPLOYMENT STEPS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ METHOD 1: Via cPanel File Manager (Easiest - No SSH needed) ─────────────────────────────────────────────────────────────────── Step 1: Login to cPanel □ Go to: https://klikcell.com:2083 □ Username: thebkihw □ Password: [your password] Step 2: Open File Manager □ Click "File Manager" icon in cPanel □ Navigate to: api.kitonga.klikcell.com folder Step 3: Upload Updated Files □ Click "Upload" button □ Upload these files: • billing/mikrotik.py (from your local project) • requirements.txt (updated version) Step 4: Edit .env File □ Find .env file in api.kitonga.klikcell.com folder □ Right-click → Edit □ Add this line at the end: MIKROTIK_MOCK_MODE=true □ Click "Save Changes" Step 5: Restart Application □ Option A: In File Manager, navigate to tmp/ folder Create new file: restart.txt □ Option B: In cPanel, find "Setup Python App" Click on your app → Restart Step 6: Test Your API □ Open terminal on your computer □ Run: curl https://api.kitonga.klikcell.com/api/health/ □ Should see: {"status": "healthy"} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ METHOD 2: Via SSH (If you have SSH access) ─────────────────────────────────────────────────────────────────── Step 1: Connect to Server □ ssh thebkihw@klikcell.com □ Enter password when prompted Step 2: Navigate to Project □ cd ~/api.kitonga.klikcell.com Step 3: Update Code □ If using git: git pull origin main □ If not using git: Upload files via cPanel File Manager first Step 4: Edit .env File □ nano .env □ Add line: MIKROTIK_MOCK_MODE=true □ Save: Ctrl+X, then Y, then Enter Step 5: Install Dependencies (if needed) □ pip install --user -r requirements.txt OR □ Use Python Selector in cPanel to install packages Step 6: Restart Application □ touch tmp/restart.txt OR □ Via cPanel: Setup Python App → Restart ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ VERIFICATION TESTS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Test 1: Health Check □ curl https://api.kitonga.klikcell.com/api/health/ Expected: {"status": "healthy"} Status: [ ] PASS [ ] FAIL Test 2: Router Endpoint (Should Fail Gracefully) □ curl -X GET https://api.kitonga.klikcell.com/api/admin/mikrotik/profiles/ \ -H "X-Admin-Access: kitonga_admin_2025" Expected: {"success": false, "message": "...not accessible..."} Status: [ ] PASS [ ] FAIL Test 3: Bundles Endpoint □ curl https://api.kitonga.klikcell.com/api/bundles/ Expected: List of bundles Status: [ ] PASS [ ] FAIL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ FILES TO UPLOAD: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Priority 1 (MUST upload): □ billing/mikrotik.py (fixed bugs) □ requirements.txt (updated routeros-api version) Priority 2 (Update in .env): □ Add: MIKROTIK_MOCK_MODE=true Priority 3 (Optional - documentation): □ SHARED_HOSTING_SETUP_GUIDE.md □ PRODUCTION_FIX_SUMMARY.md ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ WHAT WILL WORK AFTER DEPLOYMENT: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Payment processing (ClickPesa) ✅ User registration and authentication ✅ Voucher generation and redemption ✅ Bundle management ✅ User management ✅ All database operations ✅ API returns proper error messages (no more 500 errors!) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ WHAT WON'T WORK (Router Features): ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ❌ Real-time active user monitoring from production ❌ Disconnect users remotely from production dashboard ❌ Router configuration from production ❌ Hotspot profile management from production 💡 WORKAROUND: Manage router locally from your computer/office where router is located OR upgrade to VPS ($5-6/month) for full features ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ TROUBLESHOOTING: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Problem: Still getting 500 errors Solution: □ Check .env has MIKROTIK_MOCK_MODE=true □ Restart application (touch tmp/restart.txt) □ Check error logs in cPanel Problem: Cannot upload files Solution: □ Check file permissions in cPanel File Manager □ Try smaller files first □ Use compression (zip) for multiple files Problem: pip install fails Solution: □ Use Python Selector in cPanel instead □ Or contact hosting support to install packages Problem: Application not restarting Solution: □ Delete tmp/restart.txt and create it again □ Use "Setup Python App" in cPanel □ Contact hosting support ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ NEXT STEPS AFTER DEPLOYMENT: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ □ Update frontend to hide/disable router features □ Add message: "Router management available locally only" □ Test all payment and voucher flows □ Monitor error logs for any issues □ Consider VPS upgrade if you need router features ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ UPGRADE PATH (Optional): ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ If you want full router control from production: VPS Options (~$5-6/month): • DigitalOcean: $6/month • Vultr: $6/month • Linode: $5/month • Hetzner: €4.5/month Benefits: ✅ Full root access ✅ Install VPN (WireGuard) ✅ Connect to your local router ✅ All features work from production See: PRODUCTION_MIKROTIK_SETUP_GUIDE.md for VPS setup ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SUPPORT: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Hosting Issues: Contact: klikcell.com support Code Issues: Check: SHARED_HOSTING_SETUP_GUIDE.md Check: PRODUCTION_FIX_SUMMARY.md VPS Upgrade: Check: PRODUCTION_MIKROTIK_SETUP_GUIDE.md ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Deployment complete when all tests pass! 🚀 Your API will work without router features! For full router features, upgrade to VPS ($5-6/month) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ EOF