fix(api): move gunicorn worker config to python file (#2854)
### Description Passing the --lifespan flag to gunicorn does not forward the option to uvicorn.
This commit is contained in:
parent
35d7eace13
commit
43221d9d7f
|
@ -166,8 +166,7 @@ WORKDIR /app
|
||||||
|
|
||||||
CMD ["/usr/local/bin/gunicorn", \
|
CMD ["/usr/local/bin/gunicorn", \
|
||||||
"--workers=4", \
|
"--workers=4", \
|
||||||
"--worker-class=uvicorn.workers.UvicornWorker", \
|
"--worker-class=libretime_api.gunicorn.Worker", \
|
||||||
"--lifespan", "off", \
|
|
||||||
"--log-file", "-", \
|
"--log-file", "-", \
|
||||||
"--bind=0.0.0.0:9001", \
|
"--bind=0.0.0.0:9001", \
|
||||||
"libretime_api.asgi"]
|
"libretime_api.asgi"]
|
||||||
|
|
|
@ -25,8 +25,7 @@ Type=notify
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
ExecStart=@@VENV_DIR@@/bin/gunicorn \
|
ExecStart=@@VENV_DIR@@/bin/gunicorn \
|
||||||
--workers 4 \
|
--workers 4 \
|
||||||
--worker-class uvicorn.workers.UvicornWorker \
|
--worker-class libretime_api.gunicorn.Worker \
|
||||||
--lifespan off \
|
|
||||||
--log-file - \
|
--log-file - \
|
||||||
--bind unix:/run/libretime-api.sock \
|
--bind unix:/run/libretime-api.sock \
|
||||||
libretime_api.asgi
|
libretime_api.asgi
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
from uvicorn.workers import UvicornWorker # pylint: disable=import-error
|
||||||
|
|
||||||
|
|
||||||
|
class Worker(UvicornWorker):
|
||||||
|
CONFIG_KWARGS = {"lifespan": "off"}
|
Loading…
Reference in New Issue