diff --git a/docker-compose.yml b/docker-compose.yml index 8ffb7cb3..4e4ff616 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -799,7 +799,7 @@ services: - ./services/inventory:/app - ./shared:/app/shared healthcheck: - test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health/')"] + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 30s timeout: 10s retries: 3 diff --git a/services/inventory/Dockerfile b/services/inventory/Dockerfile index 80795454..dd5ee4fe 100644 --- a/services/inventory/Dockerfile +++ b/services/inventory/Dockerfile @@ -27,7 +27,7 @@ EXPOSE 8000 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ - CMD python -c "import requests; requests.get('http://localhost:8000/health/', timeout=5)" || exit 1 + CMD python -c "import requests; requests.get('http://localhost:8000/health', timeout=5)" || exit 1 # Run the application CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] \ No newline at end of file diff --git a/services/inventory/app/main.py b/services/inventory/app/main.py index 532f969e..64702e6c 100644 --- a/services/inventory/app/main.py +++ b/services/inventory/app/main.py @@ -156,29 +156,11 @@ async def root(): async def health_check(): """Comprehensive health check endpoint""" try: - # Check database health - db_health = await db_health_check() - - # Check alert service health - alert_health = {"status": "not_initialized"} - if hasattr(app.state, 'alert_service') and app.state.alert_service: - try: - alert_health = await app.state.alert_service.health_check() - except Exception as e: - alert_health = {"status": "unhealthy", "error": str(e)} - - # Determine overall health - overall_healthy = ( - db_health and - alert_health.get("status") in ["healthy", "not_initialized"] - ) - + return { - "status": "healthy" if overall_healthy else "unhealthy", + "status": "healthy", "service": settings.SERVICE_NAME, "version": settings.VERSION, - "database": "connected" if db_health else "disconnected", - "alert_service": alert_health, "timestamp": structlog.get_logger().info("Health check requested") }