Phase 8: Production Hardening & Operations · 55 min · Python · Docker · Kubernetes
Build
Practical application
In the lab, you'll take a PoC RAG application and systematically close the production gap: add async processing with Celery, implement rate limiting, migrate hardcoded keys to Secrets Manager, add JWT authentication, implement retry logic with circuit breakers, configure health probes, add structured logging with correlation IDs, and set up Prometheus metrics — checking off each item on the 40+ item hardening checklist.
Try it yourself: score a PoC's readiness by counting how many critical-severity gaps remain open.
poc_checklist = [
{"id": "sec_001", "desc": "Hardcoded API keys", "severity": "critical", "status": "failed"},
{"id": "sec_002", "desc": "No authentication", "severity": "critical", "status": "failed"},
{"id": "rel_001", "desc": "No error handling", "severity": "critical", "status": "failed"},
{"id": "scale_002", "desc": "No rate limiting", "severity": "high", "status": "failed"},
{"id": "obs_001", "desc": "Print-statement logging", "severity": "high", "status": "failed"},
{"id": "comp_002", "desc": "No data retention policy", "severity": "high", "status": "passed"},
]
def assess_readiness(checklist):
critical_failed = [i for i in checklist if i["severity"] == "critical" and i["status"] == "failed"]
high_failed = [i for i in checklist if i["severity"] == "high" and i["status"] == "failed"]
return {
"critical_failures": len(critical_failed),
"high_failures": len(high_failed),
"production_ready": len(critical_failed) == 0,
"critical_items": [i["desc"] for i in critical_failed],
}
result = assess_readiness(poc_checklist)
print(f"Critical failures: {result['critical_failures']}")
print(f"High-severity failures: {result['high_failures']}")
print(f"Production ready: {result['production_ready']}")
if not result["production_ready"]:
print("\nBlocking issues:")
for item in result["critical_items"]:
print(f" - {item}")
Your client's PoC RAG system works perfectly in demos — 10 test queries, all correct, 2-second latency. The client wants to deploy to 5,000 users tomorrow. Your hardening checklist assessment shows: hardcoded API keys (sec_001: failed), no rate limiting (scale_002: failed), no error handling (rel_001: failed), no authentication (sec_002: failed), print-statement logging (obs_001: failed). What do you tell the client?
The hardening checklist exists to prevent exactly this scenario. Three critical-severity failures means the system is NOT production-ready: (1) No authentication (sec_002) — anyone with the URL can access the system and potentially extract sensitive data. (2) Hardcoded API keys (sec_001) — if the code is leaked or accessed, the client's LLM API keys are compromised, leading to unauthorized usage and potential data exposure. (3) No error handling (rel_001) — a single LLM API timeout or rate limit will crash the process, taking down the service for all 5,000 users. Deploying now and fixing later is how AI projects get killed — the first production incident erodes client trust permanently. The 100-user pilot is a reasonable compromise IF the critical security items (auth, keys) are fixed first — but the question says "in parallel," which means you'd be running without auth for the pilot. The correct answer is to fix the critical items first (typically 2-3 days of work), then deploy. The client may push back on timeline, but FDEs are hired to prevent production disasters, not enable them.