Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace uWSGI with Gunicorn #1116

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
open-dynaMIX marked this conversation as resolved.
Show resolved Hide resolved
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
Loading