Skip to content

Commit

Permalink
Merge pull request #1116 from open-dynaMIX/gunicorn
Browse files Browse the repository at this point in the history
chore: replace uWSGI with Gunicorn
  • Loading branch information
open-dynaMIX committed Jul 18, 2024
2 parents 98b6d2a + 7f5c73d commit fb48e55
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 88 deletions.
1 change: 0 additions & 1 deletion .envs/.production.example/.api
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# API (Django)
# ------------------------------------------------------------------------------
DATABASE_HOST=db
SECRET_KEY=verysecure
ALLOWED_HOSTS=yourdomain.tld,www.yourdomain.tdl
DATABASE_PASSWORD=alsoverysecure
Expand Down
8 changes: 6 additions & 2 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ENV HOME=/home/mysagw
ENV PYTHONUNBUFFERED=1
ENV DJANGO_SETTINGS_MODULE mysagw.settings
ENV APP_HOME=/app
ENV UWSGI_INI /app/uwsgi.ini

RUN mkdir -p /app \
&& useradd -u 901 -r mysagw --create-home \
Expand All @@ -31,4 +30,9 @@ COPY . $APP_HOME

EXPOSE 8000

CMD /bin/sh -c "wait-for-it $DATABASE_HOST:${DATABASE_PORT:-5432} -- poetry run ./manage.py migrate && poetry run uwsgi"
CMD [\
"/bin/sh", "-c", \
"wait-for-it $DATABASE_HOST:${DATABASE_PORT:-5432} -- \
poetry run ./manage.py migrate && \
exec poetry run gunicorn --workers 10 --access-logfile - --limit-request-line 16384 --bind 0.0.0.0:8000 mysagw.wsgi" \
]
2 changes: 1 addition & 1 deletion api/mysagw/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
WSGI config for project_app2 project.
WSGI config for mySAGW project.
It exposes the WSGI callable as a module-level variable named ``application``.
Expand Down
35 changes: 23 additions & 12 deletions api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ django-watchman = "^1.3.0"
djangorestframework = "^3.15.2"
djangorestframework-jsonapi = "^6.0.0"
drf-extra-fields = "^3.5.0"
gunicorn = "^22.0.0"
mozilla-django-oidc = "^3.0.0"
openpyxl = "3.0.10" # TODO: dependency of `pyexcel-xlsx`. Remove as soon as https://github.com/pyexcel/pyexcel-xlsx/issues/52 is resolved
psycopg2-binary = "^2.9.6"
Expand All @@ -30,7 +31,6 @@ pyexcel-xlsx = "^0.6.0"
pypdf = "^4.1.0"
requests = "^2.32.2"
reportlab = "^4.1.0"
uwsgi = "^2.0.24"

[tool.poetry.group.dev.dependencies]
django-extensions = "^3.2.3"
Expand Down
71 changes: 0 additions & 71 deletions api/uwsgi.ini

This file was deleted.

3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:

api:
image: adfinis-sygroup/mysagw
environment:
- DATABASE_HOST=db
- DATABASE_PORT=5432
depends_on:
- db

Expand Down

0 comments on commit fb48e55

Please sign in to comment.