This commit is contained in:
@@ -88,7 +88,7 @@ services:
|
|||||||
nfoguard:
|
nfoguard:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8081/"]
|
test: ["CMD", "curl", "-f", "http://localhost:8081/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Simple script to start web interface using existing config system
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
@@ -82,6 +83,22 @@ def setup_static_files(app: FastAPI) -> None:
|
|||||||
# Return 204 No Content if no favicon found
|
# Return 204 No Content if no favicon found
|
||||||
from fastapi import Response
|
from fastapi import Response
|
||||||
return Response(status_code=204)
|
return Response(status_code=204)
|
||||||
|
|
||||||
|
# Health check endpoint for Docker
|
||||||
|
@app.get("/health")
|
||||||
|
async def health_check():
|
||||||
|
"""Health check endpoint for Docker container monitoring"""
|
||||||
|
try:
|
||||||
|
# Basic health check - verify the web service is responsive
|
||||||
|
return {
|
||||||
|
"status": "healthy",
|
||||||
|
"service": "nfoguard-web",
|
||||||
|
"timestamp": time.time(),
|
||||||
|
"version": "2.8.0-web"
|
||||||
|
}
|
||||||
|
except Exception as e:
|
||||||
|
from fastapi import HTTPException
|
||||||
|
raise HTTPException(status_code=503, detail=f"Health check failed: {e}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user