feat: 웹사이트 표준화 검사 도구 구현
- 4개 검사 엔진: HTML/CSS, 접근성(WCAG), SEO, 성능/보안 (총 50개 항목) - FastAPI 백엔드 (9개 API, SSE 실시간 진행, PDF/JSON 리포트) - Next.js 15 프론트엔드 (6개 페이지, 29개 컴포넌트, 반원 게이지 차트) - Docker Compose 배포 (Backend:8011, Frontend:3011, MongoDB:27022, Redis:6392) - 전체 테스트 32/32 PASS Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
50
backend/app/routers/health.py
Normal file
50
backend/app/routers/health.py
Normal file
@ -0,0 +1,50 @@
|
||||
"""
|
||||
Health check router.
|
||||
GET /api/health
|
||||
"""
|
||||
|
||||
import logging
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.core.redis import get_redis
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
async def health_check():
|
||||
"""Check system health including MongoDB and Redis connectivity."""
|
||||
services = {}
|
||||
|
||||
# Check MongoDB
|
||||
try:
|
||||
db = get_db()
|
||||
await db.command("ping")
|
||||
services["mongodb"] = "connected"
|
||||
except Exception as e:
|
||||
logger.error("MongoDB health check failed: %s", str(e))
|
||||
services["mongodb"] = "disconnected"
|
||||
|
||||
# Check Redis
|
||||
try:
|
||||
redis = get_redis()
|
||||
await redis.ping()
|
||||
services["redis"] = "connected"
|
||||
except Exception as e:
|
||||
logger.error("Redis health check failed: %s", str(e))
|
||||
services["redis"] = "disconnected"
|
||||
|
||||
# Overall status
|
||||
all_connected = all(v == "connected" for v in services.values())
|
||||
status = "healthy" if all_connected else "degraded"
|
||||
|
||||
return {
|
||||
"status": status,
|
||||
"timestamp": datetime.now(timezone.utc).isoformat(),
|
||||
"services": services,
|
||||
}
|
||||
Reference in New Issue
Block a user