Skip to content

Commit

Permalink
use gunicorn instead of uvicorn in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
amalshaji committed Mar 27, 2024
1 parent de1eb75 commit 02f03b3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions admin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies = [
"aiosmtplib>=3.0.1",
"cryptography>=42.0.5",
"aerich>=0.7.2",
"gunicorn>=21.2.0",
]
readme = "README.md"
requires-python = ">= 3.8"
Expand Down
3 changes: 3 additions & 0 deletions admin/requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ fastapi==0.109.2
# via portr-admin
filelock==3.13.1
# via virtualenv
gunicorn==21.2.0
# via portr-admin
h11==0.14.0
# via httpcore
# via uvicorn
Expand Down Expand Up @@ -80,6 +82,7 @@ nanoid==2.0.0
nodeenv==1.8.0
# via pre-commit
packaging==23.2
# via gunicorn
# via pytest
platformdirs==4.2.0
# via virtualenv
Expand Down
4 changes: 4 additions & 0 deletions admin/requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ email-validator==2.1.0.post1
# via portr-admin
fastapi==0.109.2
# via portr-admin
gunicorn==21.2.0
# via portr-admin
h11==0.14.0
# via httpcore
# via uvicorn
Expand All @@ -60,6 +62,8 @@ markupsafe==2.1.5
# via jinja2
nanoid==2.0.0
# via portr-admin
packaging==24.0
# via gunicorn
pycparser==2.21
# via cffi
pydantic==2.6.1
Expand Down
2 changes: 1 addition & 1 deletion admin/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

python scripts/pre-deploy.py
uvicorn src.portr_admin.main:app --host 0.0.0.0
gunicorn --config src/portr_admin/gunicorn.conf.py src.portr_admin.main:app
5 changes: 5 additions & 0 deletions admin/src/portr_admin/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os

bind = "0.0.0.0:8000"
workers = os.environ.get("GUNICORN_WORKERS", 2)
worker_class = "uvicorn.workers.UvicornWorker"

0 comments on commit 02f03b3

Please sign in to comment.