2021-10-22 15:09:44 +03:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
2020-11-12 22:50:48 +03:00
|
|
|
# see http://docs.gunicorn.org/en/latest/configure.html#configuration-file
|
|
|
|
|
|
|
|
from os import getenv
|
|
|
|
|
|
|
|
bind = f'0.0.0.0:{getenv("PORT", "8000")}'
|
2021-04-17 00:31:55 +03:00
|
|
|
workers = getenv("WEB_CONCURRENCY", 2)
|
|
|
|
accesslog = "-"
|
|
|
|
errorlog = "-"
|
|
|
|
loglevel = getenv("LOGLEVEL", "info")
|
2020-11-12 22:50:48 +03:00
|
|
|
|
|
|
|
# Larger keep-alive values maybe needed when directly talking to ELBs
|
|
|
|
# See https://github.com/benoitc/gunicorn/issues/1194
|
2021-04-17 02:35:08 +03:00
|
|
|
keepalive = getenv("WSGI_KEEP_ALIVE", 2)
|
2021-03-18 17:03:11 +03:00
|
|
|
worker_class = getenv("GUNICORN_WORKER_CLASS", "meinheld.gmeinheld.MeinheldWorker")
|
|
|
|
worker_connections = getenv("APP_GUNICORN_WORKER_CONNECTIONS", "1000")
|
|
|
|
worker_tmp_dir = "/dev/shm"
|
|
|
|
|
|
|
|
|
|
|
|
# Called just after a worker has been forked.
|
|
|
|
def post_fork(server, worker):
|
|
|
|
server.log.info("Worker spawned (pid: %s)", worker.pid)
|