Start integrating the onboarding flow with backend 16

This commit is contained in:
Urtzi Alfaro
2025-09-07 23:16:49 +02:00
parent 4c5bc0b636
commit 54102f7f4b
3 changed files with 4 additions and 22 deletions

View File

@@ -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

View File

@@ -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"]

View File

@@ -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")
}