Start integrating the onboarding flow with backend 16
This commit is contained in:
@@ -799,7 +799,7 @@ services:
|
|||||||
- ./services/inventory:/app
|
- ./services/inventory:/app
|
||||||
- ./shared:/app/shared
|
- ./shared:/app/shared
|
||||||
healthcheck:
|
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
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ EXPOSE 8000
|
|||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
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
|
# Run the application
|
||||||
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
@@ -156,29 +156,11 @@ async def root():
|
|||||||
async def health_check():
|
async def health_check():
|
||||||
"""Comprehensive health check endpoint"""
|
"""Comprehensive health check endpoint"""
|
||||||
try:
|
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 {
|
return {
|
||||||
"status": "healthy" if overall_healthy else "unhealthy",
|
"status": "healthy",
|
||||||
"service": settings.SERVICE_NAME,
|
"service": settings.SERVICE_NAME,
|
||||||
"version": settings.VERSION,
|
"version": settings.VERSION,
|
||||||
"database": "connected" if db_health else "disconnected",
|
|
||||||
"alert_service": alert_health,
|
|
||||||
"timestamp": structlog.get_logger().info("Health check requested")
|
"timestamp": structlog.get_logger().info("Health check requested")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user