Commit Graph

6 Commits

Author SHA1 Message Date
kennethreitz 2ab3dfa142 Add static site generation with nginx + hardened FastAPI sidecar
Pre-render ~1,277 high-traffic HTML pages (homepage, books, chapters)
at build time and serve them directly via nginx. All other routes
(verses, search, API, PDFs, Strong's) fall through to a FastAPI
sidecar. If the sidecar crashes, nginx continues serving static
pages and health checks.

Also harden the FastAPI app against the memory/crash issues:
- Switch from bare uvicorn to gunicorn with uvicorn workers
- Add --max-requests worker recycling to prevent memory leaks
- Add --timeout to kill hung workers
- Add per-IP rate limiting middleware (10 req/s, burst of 50)
- Add request timeout middleware (30s max per request)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:59:34 -05:00
kennethreitz bab69a756f Remove nginx configs 2025-12-01 14:28:05 -05:00
kennethreitz ad5a1e6c64 Add /health endpoint directly in nginx
Fly.io's Consul health checks hit /health. Now nginx responds
directly with 200 OK without proxying to uvicorn, so health
checks won't fail under heavy load.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 02:07:20 -05:00
kennethreitz 6a65793579 Enable nginx request logging
- Changed error_log level from warn to info
- Removed access_log off from static files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 02:03:59 -05:00
kennethreitz d630e629bd Add nginx to docker-compose setup
- nginx.conf: docker-compose version (uses 'web:8001')
- nginx-prod.conf: production version (uses '127.0.0.1:8001')
- Separate nginx service in docker-compose
- uvicorn runs on port 8001, nginx exposes 8000

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 02:01:00 -05:00
kennethreitz a32b79c885 Add nginx for HTTP request buffering
- nginx handles slow client connections, freeing uvicorn workers
- Request buffering absorbs slow uploads
- Response buffering for efficient delivery
- Static files served directly by nginx with 1y cache
- Gzip compression enabled
- Keepalive connections to uvicorn

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 02:00:00 -05:00