Files
mockupAWS/src/api/v2/endpoints/health.py
T
Luca Sacchi Ricciardi 38fd6cb562
CI/CD - Build & Test / Backend Tests (push) Has been cancelled
CI/CD - Build & Test / Frontend Tests (push) Has been cancelled
CI/CD - Build & Test / Security Scans (push) Has been cancelled
CI/CD - Build & Test / Docker Build Test (push) Has been cancelled
CI/CD - Build & Test / Terraform Validate (push) Has been cancelled
Deploy to Production / Build & Test (push) Has been cancelled
Deploy to Production / Security Scan (push) Has been cancelled
Deploy to Production / Build Docker Images (push) Has been cancelled
Deploy to Production / Deploy to Staging (push) Has been cancelled
Deploy to Production / E2E Tests (push) Has been cancelled
Deploy to Production / Deploy to Production (push) Has been cancelled
E2E Tests / Run E2E Tests (push) Has been cancelled
E2E Tests / Visual Regression Tests (push) Has been cancelled
E2E Tests / Smoke Tests (push) Has been cancelled
release: v1.0.0 - Production Ready
Complete production-ready release with all v1.0.0 features:

Architecture & Planning (@spec-architect):
- Production architecture design with scalability and HA
- Security audit plan and compliance review
- Technical debt assessment and refactoring roadmap

Database (@db-engineer):
- 17 performance indexes and 3 materialized views
- PgBouncer connection pooling
- Automated backup/restore with PITR (RTO<1h, RPO<5min)
- Data archiving strategy (~65% storage savings)

Backend (@backend-dev):
- Redis caching layer with 3-tier strategy
- Celery async jobs with Flower monitoring
- API v2 with rate limiting (tiered: free/premium/enterprise)
- Prometheus metrics and OpenTelemetry tracing
- Security hardening (headers, audit logging)

Frontend (@frontend-dev):
- Bundle optimization: 308KB (code splitting, lazy loading)
- Onboarding tutorial (react-joyride)
- Command palette (Cmd+K) and keyboard shortcuts
- Analytics dashboard with cost predictions
- i18n (English + Italian) and WCAG 2.1 AA compliance

DevOps (@devops-engineer):
- Complete deployment guide (Docker, K8s, AWS ECS)
- Terraform AWS infrastructure (Multi-AZ RDS, ElastiCache, ECS)
- CI/CD pipelines with blue-green deployment
- Prometheus + Grafana monitoring with 15+ alert rules
- SLA definition and incident response procedures

QA (@qa-engineer):
- 153+ E2E test cases (85% coverage)
- k6 performance tests (1000+ concurrent users, p95<200ms)
- Security testing (0 critical vulnerabilities)
- Cross-browser and mobile testing
- Official QA sign-off

Production Features:
 Horizontal scaling ready
 99.9% uptime target
 <200ms response time (p95)
 Enterprise-grade security
 Complete observability
 Disaster recovery
 SLA monitoring

Ready for production deployment! 🚀
2026-04-07 20:14:51 +02:00

99 lines
2.5 KiB
Python

"""API v2 health and monitoring endpoints."""
from datetime import datetime
from typing import Optional
from fastapi import APIRouter, Depends, status
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import text
from src.api.deps import get_db
from src.core.cache import cache_manager
from src.core.monitoring import metrics, metrics_endpoint
from src.core.config import settings
router = APIRouter()
@router.get("/live")
async def liveness_check():
"""Kubernetes liveness probe.
Returns 200 if the application is running.
"""
return {
"status": "alive",
"timestamp": datetime.utcnow().isoformat(),
}
@router.get("/ready")
async def readiness_check(db: AsyncSession = Depends(get_db)):
"""Kubernetes readiness probe.
Returns 200 if the application is ready to serve requests.
Checks database and cache connectivity.
"""
checks = {}
healthy = True
# Check database
try:
result = await db.execute(text("SELECT 1"))
result.scalar()
checks["database"] = "healthy"
except Exception as e:
checks["database"] = f"unhealthy: {str(e)}"
healthy = False
# Check cache
try:
await cache_manager.initialize()
cache_stats = await cache_manager.get_stats()
checks["cache"] = "healthy"
checks["cache_stats"] = cache_stats
except Exception as e:
checks["cache"] = f"unhealthy: {str(e)}"
healthy = False
status_code = status.HTTP_200_OK if healthy else status.HTTP_503_SERVICE_UNAVAILABLE
return {
"status": "healthy" if healthy else "unhealthy",
"timestamp": datetime.utcnow().isoformat(),
"checks": checks,
}
@router.get("/startup")
async def startup_check():
"""Kubernetes startup probe.
Returns 200 when the application has started.
"""
return {
"status": "started",
"timestamp": datetime.utcnow().isoformat(),
"version": getattr(settings, "app_version", "1.0.0"),
}
@router.get("/metrics")
async def prometheus_metrics():
"""Prometheus metrics endpoint."""
return await metrics_endpoint()
@router.get("/info")
async def app_info():
"""Application information endpoint."""
return {
"name": getattr(settings, "app_name", "mockupAWS"),
"version": getattr(settings, "app_version", "1.0.0"),
"environment": "production"
if not getattr(settings, "debug", False)
else "development",
"timestamp": datetime.utcnow().isoformat(),
}