From b3a8e7ea1db571243c69fd662063ff9c955e046e Mon Sep 17 00:00:00 2001 From: Juha Louhiranta Date: Tue, 25 Jul 2023 14:34:43 +0300 Subject: [PATCH 1/2] Control the amount of uWSGI proceses Defaults to the current amount of two processes and threads. Refs LINK-1393 --- .prod/uwsgi_configuration.ini | 3 +-- docker/django/docker-entrypoint.sh | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.prod/uwsgi_configuration.ini b/.prod/uwsgi_configuration.ini index 9f7726391..8742aa481 100644 --- a/.prod/uwsgi_configuration.ini +++ b/.prod/uwsgi_configuration.ini @@ -9,9 +9,8 @@ static-map = /media=$(MEDIA_ROOT) end-if = uid = nobody gid = nogroup +enable-threads = true master = 1 -processes = 2 -threads = 2 socket-timeout = 60 # Reload workers regularly to keep memory fresh diff --git a/docker/django/docker-entrypoint.sh b/docker/django/docker-entrypoint.sh index 892d218c4..24aa237be 100755 --- a/docker/django/docker-entrypoint.sh +++ b/docker/django/docker-entrypoint.sh @@ -30,5 +30,8 @@ if [[ -n "$@" ]]; then elif [[ "$DEV_SERVER" = "true" ]]; then python ./manage.py runserver_plus 0.0.0.0:8000 else - uwsgi --ini .prod/uwsgi_configuration.ini + uwsgi \ + --ini .prod/uwsgi_configuration.ini \ + --processes ${UWSGI_PROCESSES-2} \ + --threads ${UWSGI_THREADS-2} fi From 965712bade574a089a49544c82b93cb15b4a6312 Mon Sep 17 00:00:00 2001 From: Juha Louhiranta Date: Tue, 25 Jul 2023 14:42:48 +0300 Subject: [PATCH 2/2] docker-entrypoint: Print Python warnings when developing Refs LINK-1393 --- docker/django/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/django/docker-entrypoint.sh b/docker/django/docker-entrypoint.sh index 24aa237be..576462bc8 100755 --- a/docker/django/docker-entrypoint.sh +++ b/docker/django/docker-entrypoint.sh @@ -28,7 +28,7 @@ fi if [[ -n "$@" ]]; then "$@" elif [[ "$DEV_SERVER" = "true" ]]; then - python ./manage.py runserver_plus 0.0.0.0:8000 + python -Wd ./manage.py runserver_plus 0.0.0.0:8000 else uwsgi \ --ini .prod/uwsgi_configuration.ini \