CLOUDFLARE TUNNEL - COMMAND REFERENCE app-dev.heyarchie.com ================================================================================ STARTING THE TUNNEL ================================================================================ Method 1: Start in Background (Recommended for Development) $ cd /home/stuart && nohup cloudflared tunnel --config /home/stuart/.cloudflared/config-app-dev.yml run archie-ui-dev > /home/stuart/.cloudflared/config-app-dev.log 2>&1 & Method 2: Start in Foreground (For Testing/Debugging) $ cloudflared tunnel --config /home/stuart/.cloudflared/config-app-dev.yml run archie-ui-dev Method 3: Start with Custom Log Output $ cloudflared tunnel --config /home/stuart/.cloudflared/config-app-dev.yml run archie-ui-dev --loglevel debug ================================================================================ MONITORING THE TUNNEL ================================================================================ View Real-Time Logs: $ tail -f /home/stuart/.cloudflared/config-app-dev.log View Last 50 Lines of Logs: $ tail -50 /home/stuart/.cloudflared/config-app-dev.log Monitor Process Status: $ ps aux | grep cloudflared | grep -v grep Watch Continuous Metrics (if metrics server running): $ curl http://127.0.0.1:20241/metrics ================================================================================ STOPPING THE TUNNEL ================================================================================ Graceful Shutdown: $ pkill -SIGTERM -f "cloudflared tunnel.*archie-ui-dev" Force Kill: $ pkill -9 -f "cloudflared tunnel.*archie-ui-dev" Kill All Cloudflared Processes: $ pkill -f cloudflared ================================================================================ TESTING CONNECTIVITY ================================================================================ Frontend Application: $ curl -v https://app-dev.heyarchie.com/ Backend Health Check: $ curl https://app-dev.heyarchie.com/health API Endpoint (Example): $ curl https://app-dev.heyarchie.com/api/health API Documentation: $ curl https://app-dev.heyarchie.com/docs OpenAPI Schema: $ curl https://app-dev.heyarchie.com/openapi.json WebSocket Connection Test: $ wscat -c wss://app-dev.heyarchie.com/ws/your-endpoint HTTP Headers Only: $ curl -I https://app-dev.heyarchie.com/ Performance Test: $ for i in {1..10}; do time curl -s https://app-dev.heyarchie.com/health > /dev/null; done ================================================================================ CONFIGURATION MANAGEMENT ================================================================================ Validate Configuration: $ cloudflared tunnel validate --config /home/stuart/.cloudflared/config-app-dev.yml View Current Configuration: $ cat /home/stuart/.cloudflared/config-app-dev.yml Edit Configuration: $ nano /home/stuart/.cloudflared/config-app-dev.yml List All Cloudflare Tunnels: $ cloudflared tunnel list Get Tunnel Info: $ cloudflared tunnel info a9f55e3d-783c-464a-ae68-c5f10ab840b7 ================================================================================ TROUBLESHOOTING ================================================================================ Check if Required Services are Running: $ curl http://localhost:3000/ # Frontend Vite $ curl http://localhost:8000/health # Backend API Test Direct Service Access: $ curl -v http://localhost:3000/ $ curl -v http://localhost:8000/health Verify Tunnel Credentials: $ cat /home/stuart/.cloudflared/a9f55e3d-783c-464a-ae68-c5f10ab840b7.json Check Cloudflare DNS Record: $ dig app-dev.heyarchie.com $ nslookup app-dev.heyarchie.com Test Network Connectivity: $ ping -c 3 8.8.8.8 # Internet connectivity $ timeout 5 bash -c '&1 | tee /tmp/debug.log ================================================================================ RESTART PROCEDURES ================================================================================ Complete Restart (Fresh Start): $ pkill -f "cloudflared tunnel.*archie-ui-dev" $ sleep 2 $ cd /home/stuart && nohup cloudflared tunnel --config /home/stuart/.cloudflared/config-app-dev.yml run archie-ui-dev > /home/stuart/.cloudflared/config-app-dev.log 2>&1 & $ sleep 3 $ ps aux | grep cloudflared | grep -v grep Restart After Config Changes: $ pkill -SIGTERM -f "cloudflared tunnel.*archie-ui-dev" $ sleep 2 $ cd /home/stuart && nohup cloudflared tunnel --config /home/stuart/.cloudflared/config-app-dev.yml run archie-ui-dev > /home/stuart/.cloudflared/config-app-dev.log 2>&1 & $ tail -f /home/stuart/.cloudflared/config-app-dev.log ================================================================================ LOGS ANALYSIS ================================================================================ Extract Successful Requests: $ grep "200 OK" /home/stuart/.cloudflared/config-app-dev.log Extract Failed Requests: $ grep -E "ERR|error" /home/stuart/.cloudflared/config-app-dev.log Count Requests by Status: $ grep "connIndex" /home/stuart/.cloudflared/config-app-dev.log | grep -o "[0-9]\{3\} " | sort | uniq -c Monitor for Errors in Real-Time: $ tail -f /home/stuart/.cloudflared/config-app-dev.log | grep -i error Extract Tunnel Connection Info: $ grep "Registered tunnel connection" /home/stuart/.cloudflared/config-app-dev.log ================================================================================ IMPORTANT FILE LOCATIONS ================================================================================ Configuration File: /home/stuart/.cloudflared/config-app-dev.yml Credentials File: /home/stuart/.cloudflared/a9f55e3d-783c-464a-ae68-c5f10ab840b7.json Log File: /home/stuart/.cloudflared/config-app-dev.log Cloudflared Directory: /home/stuart/.cloudflared/ ================================================================================ USEFUL ALIASES (Add to ~/.bashrc) ================================================================================ alias tunnel-start='cd /home/stuart && nohup cloudflared tunnel --config /home/stuart/.cloudflared/config-app-dev.yml run archie-ui-dev > /home/stuart/.cloudflared/config-app-dev.log 2>&1 &' alias tunnel-stop='pkill -f "cloudflared tunnel.*archie-ui-dev"' alias tunnel-logs='tail -f /home/stuart/.cloudflared/config-app-dev.log' alias tunnel-status='ps aux | grep cloudflared | grep -v grep' alias tunnel-test='curl -s https://app-dev.heyarchie.com/health' ================================================================================ STATUS AS OF: 2025-11-25 17:43:00 UTC Tunnel: OPERATIONAL Process: RUNNING (PID: 827701) Connections: 4 (QUIC) Frontend: ACCESSIBLE (HTTP 200) Backend: ACCESSIBLE (HTTP 200) ================================================================================