forked from 3004B-105-TM/code-execution-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus.sh
More file actions
executable file
·88 lines (78 loc) · 2.28 KB
/
status.sh
File metadata and controls
executable file
·88 lines (78 loc) · 2.28 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
85
86
87
88
#!/bin/bash
# LeetCode Clone Code Execution Service Status Script
# This script checks the status of all services
set -e
echo "Checking service status..."
echo "=========================="
echo ""
# Check Docker service
echo "Docker Service:"
if systemctl is-active docker &> /dev/null; then
echo "✅ Docker is running"
else
echo "❌ Docker is not running"
echo " Try starting it with: systemctl start docker"
fi
echo ""
# Check if Docker Compose services are running
echo "Docker Compose Services:"
if docker-compose ps &> /dev/null; then
# Get service status
SERVICES=$(docker-compose ps --services)
for SERVICE in $SERVICES; do
STATUS=$(docker-compose ps $SERVICE | grep $SERVICE)
if [[ $STATUS == *"Up"* ]]; then
echo "✅ $SERVICE is running"
else
echo "❌ $SERVICE is not running"
fi
done
else
echo "❌ Docker Compose services are not running"
echo " Try starting them with: docker-compose up -d"
fi
echo ""
# Check API health
echo "API Health Check:"
if curl -s http://localhost:8080/health &> /dev/null; then
HEALTH=$(curl -s http://localhost:8080/health)
if [[ $HEALTH == *"ok"* ]]; then
echo "✅ API is healthy"
else
echo "⚠️ API returned unexpected response: $HEALTH"
fi
else
echo "❌ API health check failed"
echo " API is not responding at http://localhost:8080/health"
fi
echo ""
# Check Redis
echo "Redis Status:"
if docker-compose exec -T redis redis-cli ping &> /dev/null; then
PING=$(docker-compose exec -T redis redis-cli ping)
if [[ $PING == "PONG" ]]; then
echo "✅ Redis is responding"
else
echo "⚠️ Redis returned unexpected response: $PING"
fi
else
echo "❌ Redis is not responding"
fi
echo ""
# Check executor images
echo "Executor Images:"
for LANG in python javascript cpp csharp; do
if docker images | grep -q "${LANG}-executor"; then
echo "✅ ${LANG}-executor image is available"
else
echo "❌ ${LANG}-executor image is missing"
fi
done
echo ""
echo "============================"
echo "Status check completed."
echo ""
echo "For detailed logs, run:"
echo " docker-compose logs api # API service logs"
echo " docker-compose logs worker # Worker service logs"
echo ""