From bd3f526859449abe7409ebdb15ba5a5ae20b346a Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Sun, 12 Nov 2023 17:46:34 +0100 Subject: Docker: add UWSGI_WORKERS and UWSGI_THREAD environment variables (#2992) * Docker: add UWSGI_WORKERS and UWSGI_THREAD. UWSGI_WORKERS specifies the number of process. UWSGI_THREADS specifies the number of threads. The Docker convention is to specify the whole configuration through environment variables. While not done in SearXNG, these two additional variables allows admins to skip uwsgi.ini In additional, https://github.com/searxng/preview-environments starts Docker without additional files through searxng-helm-chat. Each instance consumes 1Go of RAM which is a lot especially when there are a lot of instances / pull requests. * [scripts] add environments UWSGI_WORKERS and UWSGI_THREADS - UWSGI_WORKERS specifies the number of process. - UWSGI_THREADS specifies the number of threads. Templates for uwsgi scripts can be tested by:: UWSGI_WORKERS=8 UWSGI_THREADS=9 \ ./utils/searxng.sh --cmd\ eval "echo \"$(cat utils/templates/etc/uwsgi/*/searxng.ini*)\""\ | grep "workers\|threads" Signed-off-by: Markus Heiser --------- Signed-off-by: Markus Heiser Co-authored-by: Markus Heiser --- dockerfiles/uwsgi.ini | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'dockerfiles') diff --git a/dockerfiles/uwsgi.ini b/dockerfiles/uwsgi.ini index 2d3155976..fc026b792 100644 --- a/dockerfiles/uwsgi.ini +++ b/dockerfiles/uwsgi.ini @@ -4,8 +4,12 @@ uid = searxng gid = searxng # Number of workers (usually CPU count) -workers = %k -threads = 4 +# default value: %k (= number of CPU core, see Dockerfile) +workers = $(UWSGI_WORKERS) + +# Number of threads per worker +# default value: 4 (see Dockerfile) +threads = $(UWSGI_THREADS) # The right granted on the created socket chmod-socket = 666 -- cgit v1.2.3-54-g00ecf