| # Gunicorn configuration file | |
| import multiprocessing | |
| # Server socket | |
| bind = "0.0.0.0:7860" # Use port 7860 to match the Dockerfile CMD | |
| backlog = 2048 | |
| # Worker processes | |
| workers = 2 * multiprocessing.cpu_count() + 1 # Recommended formula | |
| worker_class = "sync" | |
| worker_connections = 1000 | |
| timeout = 120 # Increase timeout to handle long-running tasks | |
| keepalive = 2 | |
| max_requests = 1000 | |
| max_requests_jitter = 100 | |
| # Logging | |
| accesslog = "-" | |
| errorlog = "-" | |
| loglevel = "info" | |
| access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %(D)s' | |
| # Process naming | |
| proc_name = "gunicorn_app" | |
| # Server mechanics | |
| preload_app = True | |
| daemon = False | |
| pidfile = "/tmp/gunicorn.pid" | |
| user = None | |
| group = None | |
| tmp_upload_dir = None | |
| # SSL | |
| keyfile = None | |
| certfile = None |