53 lines
1.0 KiB
Python
53 lines
1.0 KiB
Python
# Gunicorn configuration file for production deployment
|
|
|
|
import multiprocessing
|
|
import os
|
|
|
|
# Server socket
|
|
bind = "0.0.0.0:5000"
|
|
backlog = 2048
|
|
|
|
# Worker processes
|
|
workers = multiprocessing.cpu_count() * 2 + 1
|
|
worker_class = "sync"
|
|
worker_connections = 1000
|
|
timeout = 30
|
|
keepalive = 2
|
|
|
|
# Restart workers after this many requests, to prevent memory leaks
|
|
max_requests = 1000
|
|
max_requests_jitter = 50
|
|
|
|
# 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 = "motm_app"
|
|
|
|
# Server mechanics
|
|
daemon = False
|
|
pidfile = "/tmp/motm_app.pid"
|
|
user = None
|
|
group = None
|
|
tmp_upload_dir = None
|
|
|
|
# SSL (uncomment and configure if using HTTPS)
|
|
# keyfile = "/path/to/keyfile"
|
|
# certfile = "/path/to/certfile"
|
|
|
|
# Preload app for better performance
|
|
preload_app = True
|
|
|
|
# Environment variables
|
|
raw_env = [
|
|
'FLASK_ENV=production',
|
|
]
|
|
|
|
# Security
|
|
limit_request_line = 4094
|
|
limit_request_fields = 100
|
|
limit_request_field_size = 8190
|