diff --git a/backend/diagnose-server.sh b/backend/diagnose-server.sh new file mode 100755 index 0000000..1e19785 --- /dev/null +++ b/backend/diagnose-server.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +echo "==========================================" +echo "Backend Diagnostic Script for 10.0.10.30" +echo "==========================================" +echo "" + +echo "1. Checking Docker containers..." +docker ps --filter "name=normogen" --format "table {{.Names}} {{.Status}} {{.Ports}}" +echo "" + +echo "2. Checking if port 6500 is listening..." +sudo ss -tlnp | grep 6500 || echo "Port 6500 NOT listening" +echo "" + +echo "3. Checking firewall status..." +sudo ufw status || echo "UFW not installed" +echo "" + +echo "4. Checking Docker network..." +docker network ls | grep normogen +echo "" + +echo "5. Backend container logs (last 20 lines)..." +docker logs --tail 20 normogen-backend-dev 2>&1 +echo "" + +echo "6. Testing local connection..." +curl -s --max-time 3 http://localhost:6500/health || echo "Local connection failed" +echo "" + +echo "7. Testing container connection..." +docker exec normogen-backend-dev curl -s --max-time 3 http://localhost:8000/health || echo "Container connection failed" +echo "" + +echo "==========================================" +echo "Diagnostic complete" +echo "==========================================" diff --git a/backend/src/db/mongodb_impl.rs b/backend/src/db/mongodb_impl.rs index 343a448..efe044e 100644 --- a/backend/src/db/mongodb_impl.rs +++ b/backend/src/db/mongodb_impl.rs @@ -28,6 +28,13 @@ impl MongoDb { } Err(e) => { eprintln!("[MongoDB] ERROR: Failed to parse URI: {}", e); + + let error_msg = e.to_string().to_lowercase(); + if error_msg.contains("dns") || error_msg.contains("resolution") || error_msg.contains("lookup") { + eprintln!("[MongoDB] DNS RESOLUTION ERROR DETECTED!"); + eprintln!("[MongoDB] Cannot resolve hostname in: {}", uri); + eprintln!("[MongoDB] Error: {}", e); + } eprintln!("[MongoDB] Will continue in degraded mode (database operations will fail)"); // Create a minimal configuration that will allow the server to start