Fix jwt-token
This commit is contained in:
104
scripts/troubleshoot.sh
Normal file
104
scripts/troubleshoot.sh
Normal file
@@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Drone Detection System - Troubleshooting Script
|
||||
# This script helps diagnose common issues with the drone detection system
|
||||
|
||||
echo "🔧 Drone Detection System - Troubleshooting"
|
||||
echo "============================================"
|
||||
|
||||
# Check Docker status
|
||||
echo ""
|
||||
echo "📋 Checking Docker containers..."
|
||||
if command -v docker &> /dev/null; then
|
||||
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
||||
echo ""
|
||||
|
||||
# Check specific containers
|
||||
echo "🔍 Checking drone detection containers..."
|
||||
if docker ps | grep -q "drone-detection"; then
|
||||
echo "✅ Drone detection containers are running"
|
||||
else
|
||||
echo "❌ Drone detection containers not found. Run: docker-compose up -d"
|
||||
fi
|
||||
else
|
||||
echo "❌ Docker is not installed or not running"
|
||||
fi
|
||||
|
||||
# Check port availability
|
||||
echo ""
|
||||
echo "🌐 Checking port availability..."
|
||||
ports=(3001 3002 5433 6380)
|
||||
for port in "${ports[@]}"; do
|
||||
if ss -tulpn | grep -q ":$port "; then
|
||||
echo "✅ Port $port is in use"
|
||||
else
|
||||
echo "⚠️ Port $port is not in use"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check Nginx status
|
||||
echo ""
|
||||
echo "🌍 Checking Nginx status..."
|
||||
if command -v nginx &> /dev/null; then
|
||||
if systemctl is-active --quiet nginx; then
|
||||
echo "✅ Nginx is running"
|
||||
else
|
||||
echo "❌ Nginx is not running. Start with: sudo systemctl start nginx"
|
||||
fi
|
||||
|
||||
# Check nginx configuration
|
||||
if nginx -t &>/dev/null; then
|
||||
echo "✅ Nginx configuration is valid"
|
||||
else
|
||||
echo "❌ Nginx configuration has errors. Check with: sudo nginx -t"
|
||||
fi
|
||||
else
|
||||
echo "❌ Nginx is not installed"
|
||||
fi
|
||||
|
||||
# Check site configuration
|
||||
echo ""
|
||||
echo "📄 Checking site configuration..."
|
||||
if [ -f "/etc/nginx/sites-enabled/drones.cqers.com" ]; then
|
||||
echo "✅ Drone detection nginx config is enabled"
|
||||
else
|
||||
echo "❌ Drone detection nginx config not found"
|
||||
echo " Run the setup script: sudo ./scripts/setup-nginx.sh"
|
||||
fi
|
||||
|
||||
# Test endpoints
|
||||
echo ""
|
||||
echo "🔗 Testing endpoints..."
|
||||
endpoints=(
|
||||
"http://localhost:3001"
|
||||
"http://localhost:3002/health"
|
||||
"http://localhost/health"
|
||||
)
|
||||
|
||||
for endpoint in "${endpoints[@]}"; do
|
||||
if curl -s -f "$endpoint" >/dev/null; then
|
||||
echo "✅ $endpoint is responding"
|
||||
else
|
||||
echo "❌ $endpoint is not responding"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check logs
|
||||
echo ""
|
||||
echo "📊 Recent Docker logs (last 10 lines)..."
|
||||
if command -v docker &> /dev/null; then
|
||||
echo "--- Backend logs ---"
|
||||
docker logs --tail 10 drone-detection-backend 2>/dev/null || echo "No backend container logs"
|
||||
echo ""
|
||||
echo "--- Frontend logs ---"
|
||||
docker logs --tail 10 drone-detection-frontend 2>/dev/null || echo "No frontend container logs"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🏁 Troubleshooting complete!"
|
||||
echo ""
|
||||
echo "Common solutions:"
|
||||
echo "1. Restart containers: docker-compose restart"
|
||||
echo "2. Rebuild containers: docker-compose up -d --build"
|
||||
echo "3. Check logs: docker-compose logs -f"
|
||||
echo "4. Reload nginx: sudo systemctl reload nginx"
|
||||
Reference in New Issue
Block a user