From 17ca7eb5146c6d51c2a90f1274f0215d067bd9d8 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Sun, 5 Nov 2023 10:53:33 +0000 Subject: [PATCH] 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. --- Dockerfile | 4 +++- dockerfiles/uwsgi.ini | 8 ++++++-- docs/admin/installation-docker.rst | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 053ab123a..d08d681c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,9 @@ ENV INSTANCE_NAME=searxng \ MORTY_KEY= \ MORTY_URL= \ SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml \ - UWSGI_SETTINGS_PATH=/etc/searxng/uwsgi.ini + UWSGI_SETTINGS_PATH=/etc/searxng/uwsgi.ini \ + UWSGI_WORKERS=%k \ + UWSGI_THREADS=4 WORKDIR /usr/local/searxng 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 diff --git a/docs/admin/installation-docker.rst b/docs/admin/installation-docker.rst index c667c4f44..09471891b 100644 --- a/docs/admin/installation-docker.rst +++ b/docs/admin/installation-docker.rst @@ -92,6 +92,9 @@ instance using `docker run `_: searxng/searxng 2f998.... # container's ID +The environment variables UWSGI_WORKERS and UWSGI_THREADS overwrite the default +number of UWSGI processes and UWSGI threads specified in `/etc/searxng/uwsgi.ini`. + Open your WEB browser and visit the URL: .. code:: sh