Add production WSGI server - Flask dev server unsuitable for production load
This adds a complete production deployment setup using Gunicorn as the WSGI server, replacing Flask's development server. Key components: - Gunicorn configuration with optimized worker settings - Support for sync, threaded, and async (gevent) workers - Automatic worker recycling to prevent memory leaks - Increased timeouts for audio processing - Production-ready logging and monitoring Deployment options: 1. Docker/Docker Compose for containerized deployment 2. Systemd service for traditional deployment 3. Nginx reverse proxy configuration 4. SSL/TLS support Production features: - wsgi.py entry point for WSGI servers - gunicorn_config.py with production settings - Dockerfile with multi-stage build - docker-compose.yml with full stack (Redis, PostgreSQL) - nginx.conf with caching and security headers - systemd service with security hardening - deploy.sh automated deployment script Configuration: - .env.production template with all settings - Support for environment-based configuration - Separate requirements-prod.txt - Prometheus metrics endpoint (/metrics) Monitoring: - Health check endpoints for liveness/readiness - Prometheus-compatible metrics - Structured logging - Memory usage tracking - Request counting Security: - Non-root user in Docker - Systemd security restrictions - Nginx security headers - File permission hardening - Resource limits Documentation: - Comprehensive PRODUCTION_DEPLOYMENT.md - Scaling strategies - Performance tuning guide - Troubleshooting section Also fixed memory_manager.py GC stats collection error. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
27
requirements-prod.txt
Normal file
27
requirements-prod.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
# Production requirements for Talk2Me
|
||||
# Includes base requirements plus production WSGI server
|
||||
|
||||
# Include base requirements
|
||||
-r requirements.txt
|
||||
|
||||
# Production WSGI server
|
||||
gunicorn==21.2.0
|
||||
|
||||
# Async workers (optional, for better concurrency)
|
||||
gevent==23.9.1
|
||||
greenlet==3.0.1
|
||||
|
||||
# Production monitoring
|
||||
prometheus-client==0.19.0
|
||||
|
||||
# Production caching (optional)
|
||||
redis==5.0.1
|
||||
hiredis==2.3.2
|
||||
|
||||
# Database for production (optional, for session storage)
|
||||
psycopg2-binary==2.9.9
|
||||
SQLAlchemy==2.0.23
|
||||
|
||||
# Additional production utilities
|
||||
python-json-logger==2.0.7 # JSON logging
|
||||
sentry-sdk[flask]==1.39.1 # Error tracking (optional)
|
||||
Reference in New Issue
Block a user