Create gunicorn_config.py
Browse files- gunicorn_config.py +43 -0
gunicorn_config.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Gunicorn configuration file
|
| 2 |
+
|
| 3 |
+
# --- Server Socket ---
|
| 4 |
+
# Bind to all network interfaces on port 8000.
|
| 5 |
+
# This is a good default for containerized environments.
|
| 6 |
+
bind = "0.0.0.0:8000"
|
| 7 |
+
|
| 8 |
+
# --- Worker Processes ---
|
| 9 |
+
# The number of worker processes for handling requests.
|
| 10 |
+
# A common recommendation is (2 * number_of_cpus) + 1.
|
| 11 |
+
# For a 2 CPU container, this defaults to 5 workers.
|
| 12 |
+
workers = 5
|
| 13 |
+
|
| 14 |
+
# The type of worker to use. For an asyncio application like FastAPI,
|
| 15 |
+
# we use the Uvicorn worker class.
|
| 16 |
+
worker_class = "uvicorn.workers.UvicornWorker"
|
| 17 |
+
|
| 18 |
+
# The maximum number of simultaneous clients that a single worker can handle.
|
| 19 |
+
# This is a good starting point for I/O-bound applications.
|
| 20 |
+
worker_connections = 1000
|
| 21 |
+
|
| 22 |
+
# The maximum number of requests a worker will process before restarting.
|
| 23 |
+
# This can help prevent memory leaks.
|
| 24 |
+
max_requests = 2048
|
| 25 |
+
|
| 26 |
+
# A random jitter to the max_requests setting to prevent all workers
|
| 27 |
+
# from restarting at the same time.
|
| 28 |
+
max_requests_jitter = 512
|
| 29 |
+
|
| 30 |
+
# --- Logging ---
|
| 31 |
+
# The level of logging.
|
| 32 |
+
loglevel = "info"
|
| 33 |
+
|
| 34 |
+
# The location of the access log. "-" means log to stdout.
|
| 35 |
+
accesslog = "-"
|
| 36 |
+
|
| 37 |
+
# The location of the error log. "-" means log to stderr.
|
| 38 |
+
errorlog = "-"
|
| 39 |
+
|
| 40 |
+
# --- Process Naming ---
|
| 41 |
+
# A base to use with setproctitle to change the way Gunicorn processes are
|
| 42 |
+
# named in the process table. This affects things like `ps` and `top`.
|
| 43 |
+
proc_name = "fastapi_reverse_proxy"
|