docs(docker): Add /var space issue documentation and monitoring scripts

This commit is contained in:
goose 2026-02-15 15:18:21 -03:00
parent f0b5109f61
commit b0318430ad
4 changed files with 347 additions and 0 deletions

View file

@ -0,0 +1,40 @@
#!/bin/bash
# Monitor disk space on all filesystems
# Run this periodically to catch space issues early
echo "================================"
echo "Disk Space Check - $(date)"
echo "================================"
echo ""
# Check all filesystems
echo "All Filesystems:"
df -h
echo ""
# Check specifically /var
echo "/var Filesystem:"
df -h /var 2>/dev/null || echo "No separate /var filesystem"
echo ""
# Check Docker data location
echo "Docker Data Location:"
docker system info 2>/dev/null | grep "Docker Root Dir" || echo "Docker not accessible"
echo ""
# Check Docker space usage
echo "Docker Space Usage:"
docker system df 2>/dev/null || echo "Cannot get Docker stats"
echo ""
# Alert if any filesystem is > 90% full
echo "Alerts (filesystems > 90% full):"
df -h | awk 'NR>1 {gsub(/%/,""); if($5 > 90) print $6 " is " $5 "% full"}"
if [ $(df -h | awk 'NR>1 {gsub(/%/,""); if($5 > 90)}' | wc -l) -eq 0 ]; then
echo " No alerts"
fi
echo ""
echo "================================"
echo "Check complete"
echo "================================"

42
backend/scripts/verify-stack.sh Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
# Verify MongoDB and Backend are running correctly
echo "================================"
echo "Normogen Stack Verification"
echo "================================"
echo ""
# Check containers are running
echo "1. Checking containers..."
docker ps --format "table {{.Names}} {{.Status}} {{.Ports}}" | grep normogen
echo ""
# Check MongoDB health
echo "2. Checking MongoDB health..."
MONGO_HEALTH=$(docker inspect normogen-mongodb-dev --format='{{.State.Health.Status}}' 2>/dev/null)
echo " MongoDB Health: $MONGO_HEALTH"
echo ""
# Check if MongoDB is accepting connections
echo "3. Testing MongoDB connection..."
docker exec normogen-mongodb-dev mongosh --eval 'db.runCommand({ping: 1})' --quiet 2>/dev/null && echo " OK MongoDB is responding" || echo " FAILED MongoDB not responding"
echo ""
# Check backend logs
echo "4. Checking backend startup..."
docker logs normogen-backend-dev 2>&1 | tail -5
echo ""
# Show recent MongoDB logs
echo "5. Recent MongoDB logs..."
docker logs normogen-mongodb-dev 2>&1 | grep -E '(waiting|ready|started|ERROR)' | tail -5
echo ""
# Check filesystem space
echo "6. Checking filesystem space..."
df -h | grep -E '(Filesystem|/var|/$)'
echo ""
echo "================================"
echo "Verification complete"
echo "================================"