@@ -318,6 +318,13 @@ http {
318318 access_log off;
319319 }
320320
321+ # Ready check endpoint (no rate limiting)
322+ location /ready {
323+ proxy_pass http://fastapi_backend;
324+ proxy_set_header Host $host;
325+ access_log off;
326+ }
327+
321328 # Static files (if any)
322329 location /static/ {
323330 alias /code/static/;
@@ -554,49 +561,6 @@ DEFAULT_RATE_LIMIT_LIMIT = 100 # requests per period
554561DEFAULT_RATE_LIMIT_PERIOD = 3600 # 1 hour
555562` ` `
556563
557- # ## Health Checks
558-
559- # ### Application Health Check
560-
561- ` ` ` python
562- # src/app/api/v1/health.py
563- from fastapi import APIRouter, Depends, HTTPException
564- from sqlalchemy.ext.asyncio import AsyncSession
565- from ...core.db.database import async_get_db
566- from ...core.utils.cache import redis_client
567-
568- router = APIRouter()
569-
570- @router.get("/health")
571- async def health_check():
572- return {"status": "healthy", "timestamp": datetime.utcnow()}
573-
574- @router.get("/health/detailed")
575- async def detailed_health_check(db: AsyncSession = Depends(async_get_db)):
576- health_status = {"status": "healthy", "services": {}}
577-
578- # Check database
579- try:
580- await db.execute("SELECT 1")
581- health_status["services"]["database"] = "healthy"
582- except Exception:
583- health_status["services"]["database"] = "unhealthy"
584- health_status["status"] = "unhealthy"
585-
586- # Check Redis
587- try:
588- await redis_client.ping()
589- health_status["services"]["redis"] = "healthy"
590- except Exception:
591- health_status["services"]["redis"] = "unhealthy"
592- health_status["status"] = "unhealthy"
593-
594- if health_status["status"] == "unhealthy":
595- raise HTTPException(status_code=503, detail=health_status)
596-
597- return health_status
598- ` ` `
599-
600564# ## Deployment Process
601565
602566# ### CI/CD Pipeline (GitHub Actions)
0 commit comments