Use gunicorn

This commit is contained in:
2023-05-19 18:34:19 +02:00
parent 2c846fa2fc
commit eb2d8a0584
3 changed files with 26 additions and 3 deletions

25
poetry.lock generated
View File

@@ -361,6 +361,27 @@ files = [
docs = ["Sphinx", "docutils (<0.18)"] docs = ["Sphinx", "docutils (<0.18)"]
test = ["faulthandler", "objgraph", "psutil"] test = ["faulthandler", "objgraph", "psutil"]
[[package]]
name = "gunicorn"
version = "20.1.0"
description = "WSGI HTTP Server for UNIX"
category = "main"
optional = false
python-versions = ">=3.5"
files = [
{file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"},
{file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"},
]
[package.dependencies]
setuptools = ">=3.0"
[package.extras]
eventlet = ["eventlet (>=0.24.1)"]
gevent = ["gevent (>=1.4.0)"]
setproctitle = ["setproctitle"]
tornado = ["tornado (>=0.2)"]
[[package]] [[package]]
name = "h11" name = "h11"
version = "0.14.0" version = "0.14.0"
@@ -1137,7 +1158,7 @@ tornado = ["tornado (>=5)"]
name = "setuptools" name = "setuptools"
version = "65.6.3" version = "65.6.3"
description = "Easily download, build, install, upgrade, and uninstall Python packages" description = "Easily download, build, install, upgrade, and uninstall Python packages"
category = "dev" category = "main"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
@@ -1489,4 +1510,4 @@ files = [
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.11" python-versions = "^3.11"
content-hash = "97fc164b158b45bce4687439d5cedbd8ecb742c928cb191b120e649af720fbdc" content-hash = "b9d8baa448204dcc6762e64dbb48fee2654243232c8fccb61e962fe398383dfc"

View File

@@ -19,6 +19,7 @@ prometheus-fastapi-instrumentator = "^6.0.0"
uvloop = "^0.17.0" uvloop = "^0.17.0"
sentry-sdk = "^1.22.2" sentry-sdk = "^1.22.2"
redis = {extras = ["hiredis"], version = "^4.5.5"} redis = {extras = ["hiredis"], version = "^4.5.5"}
gunicorn = "^20.1.0"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pre-commit = "^2.21.0" pre-commit = "^2.21.0"

View File

@@ -4,4 +4,5 @@ rm -rf prometheus
mkdir prometheus mkdir prometheus
alembic -c ./app/alembic.ini upgrade head alembic -c ./app/alembic.ini upgrade head
uvicorn main:app --host 0.0.0.0 --port 8080 --loop uvloop --workers 2 --timeout-keep-alive 30
gunicorn -k uvicorn.workers.UvicornWorker main:app --bind 0.0.0.0:8080 --timeout 30 --max-requests=1024 --max-requests-jitter=8