docs: add DOCKER_GUIDE.md and fix .env parsing; chore: update docker and script configurations
This commit is contained in:
31
scripts/health_check.sh
Normal file
31
scripts/health_check.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Health check script for cron/scheduler
|
||||
|
||||
# Check if containers are running
|
||||
if ! docker ps | grep -q "btc_timescale"; then
|
||||
echo "ERROR: TimescaleDB container not running"
|
||||
# Send notification (if configured)
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! docker ps | grep -q "btc_collector"; then
|
||||
echo "ERROR: Data collector container not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check database connectivity
|
||||
docker exec btc_timescale pg_isready -U btc_bot -d btc_data > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Cannot connect to database"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if recent data exists
|
||||
LATEST=$(docker exec btc_timescale psql -U btc_bot -d btc_data -t -c "SELECT MAX(time) FROM candles WHERE time > NOW() - INTERVAL '5 minutes';" 2>/dev/null)
|
||||
if [ -z "$LATEST" ]; then
|
||||
echo "WARNING: No recent data in database"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "OK: All systems operational"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user