Commit Graph

25 Commits

Author SHA1 Message Date
Alexandre Flament
bd3f526859
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>
2023-11-12 16:46:34 +00:00
Markus Heiser
51bcd95a75 [fix] harmonize default settings for caching of /static files
Caching files on the client side for more than a day can confuse the end user
when updating static files[1].

Depending on the way of providing a SearXNG instance via HTTP, there are several
ways to optimize the access to the /static files.  However, since we don't know
what optimization an admin has provided for his static files, we should have
moderate settings in the defaults that run robustly in a wide variety of
installations.

In this sense, all caches on the client side should be cleared after one day at
the latest.  So far the files were cached for one year on client side; as soon
as changes are made to the static files (with the option `static_use_hash:
true`) the old static files are kept for one year on the CLient side / which can
also be evaluated as unnecessary caching.

[1] https://github.com/searxng/searxng/discussions/2821

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-09-25 22:52:23 +02:00
Alexandre Flament
4573417b6c uwsgi.ini: remove unused cache2
cache2 was used before PR #1856
2023-08-13 07:55:05 +02:00
Immánuel!
caf4785663
Let uWSGI workers and threads be adjustable from env 2023-01-11 14:53:36 +01:00
Markus Heiser
ba8959ad7c [fix] typos / reported by @kianmeng in searx PR-3366
[PR-3366] https://github.com/searx/searx/pull/3366

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-27 18:32:14 +02:00
Alexandre Flament
12d3fe3214 docker: log to stdout
previously the log (only the exceptions) were log
into /var/log/uwsgi/uwsgi.log

this is disturbing for the admins:
* they see an internal error on HTTP port
* no log where they are expected (docker logs)

this commit fixes this issue
2022-03-19 13:47:45 +01:00
Alexandre Flament
5583336440 [docker] change static-expires to one year 2022-03-05 10:52:34 +00:00
Markus Heiser
4fec7a74e5 [fix] docker generated new settings.yml does not work
In commit 5a7b12e we normalized settings.yml and c6a5cc019 and de5a8ee7d we
changed instance name to ``instance_name: "SearXNG"``.

This patch adjust the sed expressions to modify:

    dockerfiles/docker-entrypoint.sh

Closes: https://github.com/searxng/searxng/issues/876
Suggested-by:  @neiaberau
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-02-06 16:35:29 +01:00
Alexandre Flament
55ae74d725 [mod] adjust dockerfiles/uwsgi.ini 2022-01-05 21:06:25 +01:00
Alexandre Flament
9e03823b98 SearXNG: docker 2021-10-12 20:23:57 +02:00
Alexandre Flament
253b850376 SearXNG: SEARXNG_SETTINGS_PATH 2021-10-02 17:18:05 +02:00
Markus Heiser
d6c321b830 [mod] docker-entrypoint.sh - add script to make test.sh (shellcheck)
Add script docker-entrypoint.sh to shellcheck and try to _simplify_ and
_normalize_ some parts:

- fix issues reported by shellcheck
- don't mix tab and space indent
- command 'help' replaced by '-h': ./dockerfiles/docker-entrypoint.sh -h
- replace printf in help() by 'cat <<EOF'

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-05-17 12:02:24 +02:00
Alexandre Flament
b46a3ecfc7 [fix] fix usage of docker environment variable INSTANCE_NAME
INSTANCE_NAME was ignored.

close #65
2021-05-09 11:00:28 +02:00
3nprob
0fb423ea59 Allow overriding env vars SEARX_SETTINGS_PATH,UWSGI_SETTINGS_PATH 2021-04-08 12:56:15 +09:00
Alexandre Flament
6e2872f436 [enh] add searx.shared
shared dictionary between the workers (UWSGI or werkzeug)
scheduler: run a task once every x seconds (UWSGI or werkzeug)
2021-01-12 11:47:17 +01:00
Alexandre Flament
38d32337e7 [mod] documentations & comments: update http://* URL to https://*.
About http://lesscss.org see https://github.com/less/less-docs/issues/520
2020-12-04 16:52:25 +01:00
Alexandre Flament
4cc8644ec9
Merge pull request #1865 from dalf/uwsgi_static
[enh] Docker image: uwsgi serves the static files directly.
2020-09-19 16:04:07 +02:00
Alexandre Flament
8ffede6140 [fix] docker and k8s: run searx
fix #2181
2020-09-10 10:07:49 +02:00
Markus Heiser
9b9b5e9625
[fix] docker-entrypoint.sh -h hangs if searx is a valid user (#2099)
Implement a more robust detection if a process runs inside or outside of a
docker image.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-08-18 19:14:06 +02:00
Dalf
4a35975b42 [enh] update documentation about docker 2020-07-22 14:58:04 +02:00
Dalf
678d41d75b [enh] Docker image: uwsgi serves the static files directly.
When the image is built, the static files are compressed with gzip and brotli.
The expires header is set to one day (same as Flask)
There is not etag header (Flask does add an etag header)
2020-02-25 17:25:11 +01:00
Dalf
0579d93783 [fix] Disable HTTP keep alive
Fix HTTP 429 response from filtron
See https://github.com/searx/searx-docker/issues/24
2020-02-07 19:16:15 +01:00
mathieu.brunot
2485d41bdd
🐳 Config for instance name and autocomplete
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
2019-10-14 02:02:41 +02:00
Alexandre Flament
91a59ff350
[fix] Docker: without -f parameter, settings.yml is not replaced by the new version (#1668)
Before this commit, the existing settings.yml were always replaced.
2019-08-03 13:53:14 +02:00
Dalf
fbe40001d3 Update Docker image
See #1561 , use uwsgi and Alpine Linux

Volume:
/var/log/uwsgi contains error log for 2 days (file uwsgi.log)
/etc/searx contains the settings.yml and uwsgi.ini files.
The docker image creates them if they don't exist.
The two files can be modified after the first run. See below.

Environement variables:
MORTY_URL : external URL of Morty
MORTY_KEY : base64 encoded key
BASE_URL : external URL of Searx
BIND_ADDRESS : internal HTTP port to listen to

Labels : org.label-schema.schema.*

Parameters:
-h : display this help
-d : will update the settings and quit immediately (settings.yml and uwsgi.ini)
-f : always update the settings (previous version saved with suffix .old).
     without this parameter, the new settings are copied with suffix .new

When the Docker image contains newer settings:
- without -f parameter: the new versions are copied to /etc/searx/settings.yml.new and /etc/searx/uwsgi.ini.new.
- with -f parameter:  the old versions are renamed with .old suffix. The new version replaces /etc/searx/settings.yml and /etc/searx/uwsgi.ini

Build using "./manage.sh docker_build", add "push" as parameter also push the Docker image.
The script requires a git repository to work (it makes sure that the last git tag matches searx/version.py)
"git describe" is used to create a meaningful version.
Example : 0.15.0-90-49c5bcb4-dirty (dirty means that the docker image was made with uncommited changes).

Use "docker inspect -f {{.Config.Labels.version}} searx" to get the version of an existing image.

.dockerignore based on .gitignore

.travis.yml: include docker stage
2019-07-13 15:49:59 +02:00