-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiagnose.sh
More file actions
85 lines (74 loc) · 2.37 KB
/
Copy pathdiagnose.sh
File metadata and controls
85 lines (74 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
echo "================================================"
echo " Net Control by K4HEF - Diagnostic Script"
echo "================================================"
echo ""
echo "1. Checking Docker installation..."
if command -v docker &> /dev/null; then
echo "✅ Docker is installed"
docker --version
else
echo "❌ Docker is not installed or not in PATH"
exit 1
fi
echo ""
echo "2. Checking Docker daemon status..."
if docker info &> /dev/null; then
echo "✅ Docker daemon is running"
else
echo "❌ Docker daemon is not running"
echo "Please start Docker Desktop and try again"
exit 1
fi
echo ""
echo "3. Checking for running containers..."
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
echo ""
echo "4. Checking for NetControl containers..."
docker ps -a --filter "name=netcontrol" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
echo ""
echo "5. Checking port 80 availability..."
if lsof -i :80 &> /dev/null; then
echo "⚠️ Port 80 is in use by:"
lsof -i :80
echo ""
echo "SOLUTION: Port 80 is already in use. You have two options:"
echo " 1. Stop the service using port 80"
echo " 2. Or edit docker-compose.yml to use a different port (e.g., 8080)"
else
echo "✅ Port 80 is available"
fi
echo ""
echo "6. Checking port 5000 availability..."
if lsof -i :5000 &> /dev/null; then
echo "⚠️ Port 5000 is in use by:"
lsof -i :5000
else
echo "✅ Port 5000 is available"
fi
echo ""
echo "7. Checking .env file..."
if [ -f .env ]; then
echo "✅ .env file exists"
else
echo "⚠️ .env file not found, creating one..."
cat > .env << 'EOF'
JWT_SECRET=NetControl2024SecureKeyForYorkCountyAmateurRadioSociety_ChangeInProduction
EOF
echo "✅ .env file created"
fi
echo ""
echo "8. Recent Docker logs for NetControl containers..."
echo ""
echo "--- Frontend Logs ---"
docker logs netcontrol-frontend --tail 20 2>&1 || echo "Frontend container not found or not started"
echo ""
echo "--- Backend Logs ---"
docker logs netcontrol-backend --tail 20 2>&1 || echo "Backend container not found or not started"
echo ""
echo "--- MongoDB Logs ---"
docker logs netcontrol-mongodb --tail 20 2>&1 || echo "MongoDB container not found or not started"
echo ""
echo "================================================"
echo " Diagnostic Complete"
echo "================================================"