Commit
·
ad8ebb5
1
Parent(s):
22041f5
Create health_check.sh
Browse files- health_check.sh +37 -0
health_check.sh
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Health check script for Docker container
|
2 |
+
set -e
|
3 |
+
|
4 |
+
# Check if FastAPI is responding
|
5 |
+
if ! curl -s -f "http://127.0.0.1:8000/docs" > /dev/null; then
|
6 |
+
echo "FastAPI health check failed"
|
7 |
+
exit 1
|
8 |
+
fi
|
9 |
+
|
10 |
+
# Check if Streamlit is responding
|
11 |
+
if ! curl -s -f "http://127.0.0.1:7860/_stcore/health" > /dev/null; then
|
12 |
+
echo "Streamlit health check failed"
|
13 |
+
exit 1
|
14 |
+
fi
|
15 |
+
|
16 |
+
# Check if required files exist
|
17 |
+
required_files=(
|
18 |
+
"/tmp/model.pkl"
|
19 |
+
"/tmp/vectorizer.pkl"
|
20 |
+
"/tmp/data/combined_dataset.csv"
|
21 |
+
)
|
22 |
+
|
23 |
+
for file in "${required_files[@]}"; do
|
24 |
+
if [ ! -f "$file" ]; then
|
25 |
+
echo "Required file missing: $file"
|
26 |
+
exit 1
|
27 |
+
fi
|
28 |
+
done
|
29 |
+
|
30 |
+
# Check if processes are running
|
31 |
+
if ! pgrep -f "schedule_tasks.py" > /dev/null; then
|
32 |
+
echo "Scheduler process not running"
|
33 |
+
exit 1
|
34 |
+
fi
|
35 |
+
|
36 |
+
echo "All health checks passed"
|
37 |
+
exit 0
|