summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2023-11-12 17:46:34 +0100
committerGitHub <noreply@github.com>2023-11-12 16:46:34 +0000
commitbd3f526859449abe7409ebdb15ba5a5ae20b346a (patch)
treeadd692ed0c967861e5a035cec1fc723fd8472d2e /utils
parent7b1951aa97f05bf679d36574a16c8a85995cc9c1 (diff)
downloadsearxng-bd3f526859449abe7409ebdb15ba5a5ae20b346a.tar.gz
searxng-bd3f526859449abe7409ebdb15ba5a5ae20b346a.zip
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 <markus.heiser@darmarit.de> --------- Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/searxng.sh1
-rw-r--r--utils/templates/etc/uwsgi/apps-archlinux/searxng.ini3
-rw-r--r--utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket3
-rw-r--r--utils/templates/etc/uwsgi/apps-available/searxng.ini3
-rw-r--r--utils/templates/etc/uwsgi/apps-available/searxng.ini:socket3
5 files changed, 13 insertions, 0 deletions
diff --git a/utils/searxng.sh b/utils/searxng.sh
index e04f87e10..197188a4a 100755
--- a/utils/searxng.sh
+++ b/utils/searxng.sh
@@ -177,6 +177,7 @@ main() {
case $1 in
--getenv) var="$2"; echo "${!var}"; exit 0;;
+ --cmd) shift; "$@";;
-h|--help) usage; exit 0;;
install)
sudo_or_exit
diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini
index 351965a1e..650c8cc3f 100644
--- a/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini
+++ b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini
@@ -47,6 +47,9 @@ plugin = python
# default behaviour is for performance reasons.
enable-threads = true
+# Number of workers (usually CPU count)
+workers = ${UWSGI_WORKERS:-%k}
+threads = ${UWSGI_THREADS:-4}
# plugin: python
# --------------
diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket
index 0f36e4178..eb1220233 100644
--- a/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket
+++ b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket
@@ -47,6 +47,9 @@ plugin = python
# default behaviour is for performance reasons.
enable-threads = true
+# Number of workers (usually CPU count)
+workers = ${UWSGI_WORKERS:-%k}
+threads = ${UWSGI_THREADS:-4}
# plugin: python
# --------------
diff --git a/utils/templates/etc/uwsgi/apps-available/searxng.ini b/utils/templates/etc/uwsgi/apps-available/searxng.ini
index caefdf0bb..7d367d9ee 100644
--- a/utils/templates/etc/uwsgi/apps-available/searxng.ini
+++ b/utils/templates/etc/uwsgi/apps-available/searxng.ini
@@ -50,6 +50,9 @@ plugin = python3,http
# default behaviour is for performance reasons.
enable-threads = true
+# Number of workers (usually CPU count)
+workers = ${UWSGI_WORKERS:-%k}
+threads = ${UWSGI_THREADS:-4}
# plugin: python
# --------------
diff --git a/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket b/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket
index 516787be1..2f95fab7c 100644
--- a/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket
+++ b/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket
@@ -50,6 +50,9 @@ plugin = python3,http
# default behaviour is for performance reasons.
enable-threads = true
+# Number of workers (usually CPU count)
+workers = ${UWSGI_WORKERS:-%k}
+threads = ${UWSGI_THREADS:-4}
# plugin: python
# --------------