summaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Collapse)Author
2025-08-07[enh] container: tidy builds (#5086)Ivan Gabaldon
Building the container currently does not work properly. When rebuilding several times with `make container`, `version_frozen.py` is recreated, which wouldn't be an issue if the file’s timestamp was constant. Now, when creating `version_frozen.py`, it will have the same timestamp as the commit when it was created. (`version_frozen.py` is moved to a dedicated layer). Reusing "builder" cache when building "dist" could be slow (CD reports 2 seconds, but locally I've seen it take up to 10 seconds), so the Dockerfile is now split and we save a couple steps by importing the "builder" image directly. The last changes made it possible to remove the layer cache in "builder", since the overhead is now greater than building the layers from scratch. Until now, all "dist" layers were squashed into a single layer, which in most cases is a good idea (except for storage/delivery pricing/overhead), but in our case, since we manage the entire pipeline, we can ignore this and share layers between builds. This means (for example) that if we change files unrelated to the container in several consecutive commits (documentation changes), we don't have to push the entire image to registry, but only the different layers (`version_frozen.py` in this example). The same applies when pulling, as only the layers that have changed compared to the local layers will be downloaded (that's the theory, we'll see if this works as expected or if we need to tweak something else).
2025-08-01[enh] container: latest tag should be last (#5078)Ivan Gabaldon
With this change, the "latest" tag will be visually higher (on registry tag list). Right now, it appears under the "DOCKER_TAG" manifest tag, which can be confusing.
2025-07-28[fix] apply shell formating / shfmt (make format.shell)Markus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-28[fix] don't install pyright twice and do some clean upMarkus Heiser
Pyright has been installed twice so far, once via `package.json` and once in the test script via `npx --no-install`. Separating the type checks in the CI and on the developer desktop is also not necessary. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-28[enh] CI - add shell script formatterMarkus Heiser
Implement rules and functions to format shell scripts: $ make format.shell or alternatively to format all source code: $ make format The formatter `shfmt` reads the rules from the editorconfig[1] If any EditorConfig files are found, they will be used to apply formatting options. If any parser or printer flags are given to the tool, no EditorConfig files will be used. [1] https://github.com/patrickvane/shfmt?tab=readme-ov-file#description Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-28[mod] create a Go project with the developer tools from GoMarkus Heiser
The `go.mod` was created by:: $ ./manage dev.env (dev.env)$ go mod init searxng.org/devtools (dev.env)$ go get -tool mvdan.cc/sh/v3/cmd/shfmt@v3.12.0 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-28[mod] add Golang ecosystem to the SearXNG toolchainMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-28[chore] overdue maintenance of shell scriptsMarkus Heiser
Removes obsolete scripts and fix various leftovers. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-26[fix] cleanup: rename `searx` leftovers to `SearXNG` (#5049)Markus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-23[enh] py: whitenoise for static handling (#5032)Ivan Gabaldon
While looking at ways to better handle static files, I saw a package that replaces Flask `static_folder` functionality. Not only it's considerably faster, but already includes the capability to serve sidecars without having to intercept. This also replaces the uWSGI folder mapping functionality. Closes https://github.com/searxng/searxng/issues/4977
2025-07-11[mod] remove option ui.static_use_hash (cache busting) (#5004)Markus Heiser
Cache busting has caused serious problems for users in the past, here are two examples: - https://github.com/searxng/searxng/issues/4419 - https://github.com/searxng/searxng/issues/4481 And it makes development and deployment significantly more complex because it binds the client side to the server side: - https://github.com/searxng/searxng/pull/4466 In the light of a decoupled development of the WEB clients from the server side: - https://github.com/searxng/searxng/pull/4988 is it appropriate to abandon this feature. In fact, it has been ineffective since #4436 anyway. However, the benefit has always been questionable, since at best only a few kB of data are saved (at least in the context of an image_proxy, the effect is below the detection limit). Ultimately, the client is responsible for caching. Related: https://github.com/searxng/searxng/issues?q=label%3A%22clear%20browser%20cache%22 Closes: https://github.com/searxng/searxng/pull/4466 Closes: https://github.com/searxng/searxng/issues/1326 Closes: https://github.com/searxng/searxng/issues/964 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-09[mod] migrate from Redis to Valkey (#4795)Gaspard d'Hautefeuille
This patch migrates from `redis==5.2.1` [1] to `valkey==6.1.0` [2]. The migration to valkey is necessary because the company behind Redis has decided to abandon the open source license. After experiencing a drop in user numbers, they now want to run it under a dual license again. But this move demonstrates once again how unreliable the company is and how it treats open source developers. To review first, read the docs:: $ make docs.live Follow the instructions to remove redis: - http://0.0.0.0:8000/admin/settings/settings_redis.html Config and install a local valkey DB: - http://0.0.0.0:8000/admin/settings/settings_valkey.html [1] https://pypi.org/project/redis/ [2] https://pypi.org/project/valkey/ Co-authored-by: HLFH <gaspard@dhautefeuille.eu> Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-04[mod] container: replace uWSGI with Granian (#4820)Ivan Gabaldon
* [mod] container: replace uWSGI with Granian The configuration in Granian is handled with ENVs, much more convenient and practical for updating. The settings have been tested for over two months in a production instance, being usable on small to somewhat large instances without having to modify anything. It also removes the patch functions and ENVs abstraction from the entrypoint, this makes it possible to run the container with immutable configuration. In some setups, It may be desired to have the volumes/files under a specific uid/gid (other than searxng:searxng), if the entrypoint has root permissions it will chown automatically on every start, which may not be desired. Explicitly setting the new ENV `FORCE_OWNERSHIP=false` will prevent ownership from being modified. No manual migration is necessary **unless** the user has changed the default uWSGI configuration or has a very specific setup. Closes https://github.com/searxng/searxng/issues/4894 Closes https://github.com/searxng/searxng/issues/4818 Closes https://github.com/searxng/searxng/issues/4802 Supersedes https://github.com/searxng/searxng/pull/4596 Related https://github.com/searxng/searxng/discussions/4479 * [mod] docs: add container/granian All container documentation has been recreated. A new documentation page has been created for Granian. * [enh] misc: apply suggestions Minor documentation changes. Suggested https://github.com/searxng/searxng/pull/4820#discussion_r2134539259 Suggested https://github.com/searxng/searxng/pull/4820#discussion_r2134538610 Suggested https://github.com/searxng/searxng/pull/4820#discussion_r2134827964 Suggested https://github.com/searxng/searxng/pull/4820#discussion_r2134544300 Suggested https://github.com/searxng/searxng/pull/4820#discussion_r2149387388 --------- Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> Co-authored-by: Ivan Gabaldon <igabaldon@inetol.net> Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-03[mod] theme/simple: improve fmt/lint techIvan Gabaldon
This is one of various PR to refactor the simple theme internally. Replace eslint tool with Biome. I have been using this for quite some time, and it will help us to have more consistent and valid code without extending on other third party plugins. Removes unused dependencies.
2025-06-26[fix] container: remove HEALTHCHECK (#4941)Ivan Gabaldon
This is a poorly designed instruction, which is hardcoded and cannot be easily modified or maintained on a rolling release sw like ours. This *should* be set in the SearXNG Docker Compose template, not in the image itself. The OCI format is now used since we no longer have the HEALTHCHECK on the Dockerfile. Closes https://github.com/searxng/searxng/issues/4906 Closes https://github.com/searxng/searxng/issues/4722
2025-06-25[fix] debian: install apt package python-is-python3Markus Heiser
On debian the 'python-is-python3' packages restores an appropriate '/usr/bin/python' symlink for third-party scripts[1] [1] https://github.com/searxng/searxng/issues/3235#issuecomment-1954459081 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-06-03[mod] container: revert to alpine (#4893)Ivan Gabaldon
I'm not too pleased to reverse this, but issues like https://github.com/searxng/searxng/issues/4792 have not been foreseen, and we can't just turn away. It has become apparent over the last weeks that there are still quite a few people with an incompatible CPU or having SearXNG on some random VM provider who can't (or won't) modify the configuration of their machines to expose the features needed for x86_64v2 march. As I don't want to trash the work with apko and base images, I thought about trying building Alpine again now that we have all the container related workflow refactored. There will still be the discussion of whether to use musl and its drawbacks, but right now I don't know any other alternatives. The nice part of this is that both Dockerfiles (mainline and legacy) can now be unified under the same umbrella again. Closes https://github.com/searxng/searxng/issues/4792 Closes https://github.com/searxng/searxng/issues/4753
2025-05-20[chore] fix some docstring typos (#4815)Jost Alemann
2025-05-20[mod] container: refactor entrypoint scriptIvan Gabaldon
That entrypoint is prone to screw things up, especially with permission handling. The new script handles initialization better and fixes some issues like delayed settings update via ENVs and timestamp overwriting, also adjusts what should be copied into the container. Related https://github.com/searxng/searxng/pull/4721#issuecomment-2850272129
2025-05-15[enh] container: support multiple registriesIvan Gabaldon
Allows to push the manifests to other registries, this allows to push both docker.io and ghcr.io registries.
2025-05-14[fix] CI: handle old cache images from registryIvan Gabaldon
Currently, we have 1100~ cache images uploaded to GHCR that weigh more than 300 MB each (most of them are layers from the second phase of the Dockerfile that were uploaded by mistake, read below). To avoid problems, I have set up a new job in a new workflow to be run weekly purging all images older than 1 week, but leaving always the 100 most recent ones. Only the builder images should be uploaded to cache, the actual behaviour not only slows down the time for building the container, but also wastes lots of space by saving large and useless layers to GHCR that will never be used again.
2025-05-13[enh] tidy: clean old morty, filtron, searx referencesIvan Gabaldon
Everyone should have already switched from legacy methods
2025-05-12[mod] lib_sxng_container.sh: replace echo commands with heredocIvan Gabaldon
Suggested-by: @return42 https://github.com/searxng/searxng/pull/4764#discussion_r2083571202
2025-05-12[mod] lib_sxng_container.sh use required_commands() helperIvan Gabaldon
Suggested-by: @return42 https://github.com/searxng/searxng/pull/4764#discussion_r2083564489
2025-05-11[mod] rework container deployment (#4764)Ivan Gabaldon
container.yml will run after integration.yml COMPLETES successfully and in master branch. Style changes, cleanup and improved integration with CI by leveraging the use of shared cache between all workflows. * Podman is now supported to build the container images (Docker also received a refactor, merging both build and buildx) * Container images are being built by Buildah instead of Docker BuildKit. * Container images are tested before release. * Splitting "modern" (amd64 & arm64) and "legacy" (armv7) arches on different Dockerfiles allowing future optimizations.
2025-05-09[fix] static.build.commit: add missing searx/templates/simple/icons.htmlMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-04-17[fix] settings.yml files: doc & obsolete settings in the templateMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-03-18[fix] static.build: upgrade min. node version to 18.17Alexandre Flament
For sharp [1] dependency / this commit was cherry picked from PR #3157 [1] https://www.npmjs.com/package/sharp
2025-03-15[fix] make static.build.commit: add client/simple/package-lock.jsonMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-03-08[fix] uwsgi: don't set static-expiresMarkus Heiser
As long we don't have a working solution for cache busting [3][4] we should not set an expire time in thw uWSGI config. The default procedure in every web browser is the "304 Not Modified" [2] and this default procedure should also be sufficient for us as long as we have not implemented a complete alternative (cache busting) / form [1] > By default uWSGI will add a Last-Modified [2] header to all static responses, > and will honor the If-Modified-Since [2] request header. [1] https://uwsgi-docs.readthedocs.io/en/latest/StaticFiles.html#setting-the-expires-headers [2] https://developer.mozilla.org/de/docs/Web/HTTP/Status/304 [3] https://github.com/searxng/searxng/pull/4433 [4] https://github.com/searxng/searxng/issues/964 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-03-01[fix] wikidata: increase wikidata queries timeoutMarkus Heiser
The big queries for initializing and updating the currencies take longer than the default of the wikidata engine, which is only 3sec. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-02-28[web-client] integrate the migrated theme in the development workflowsMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-02-28[web-client] simple theme: refactor jinja_svg_catalog and cleanup icon namesMarkus Heiser
This patch implements the template generation of the template: searx/templates/simple/icons.html by the way the icon set (the icon names) has been normalized: film-outline --> film magnet-outline --> magnet .. warning --> alert Some missing (categorie) icons had been added. Some of the ionicons are not suitable for a dark theme, we fixed the svg manually in src/svg/ionicons: - https://github.com/searxng/searxng/pull/4284#issuecomment-2680550342 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-02-28[web-client] simple theme: build & development env based on vite.Markus Heiser
Vite is a build tool, it consists of two major parts [1]: - A dev server that provides rich feature enhancements over native ES modules, for example extremely fast Hot Module Replacement (HMR). - A build command that bundles your code with Rollup, pre-configured to output highly optimized static assets for production. [1] https://vite.dev/guide/ Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-02-07[fix] selenium: binary is not a Firefox executableMarkus Heiser
Since Ubuntu installs firefox frrom snap, we can't use any longer ``Browser('firefox')``. [1] https://github.com/searxng/searxng/pull/3663#issuecomment-2255963036 [2] https://splinter.readthedocs.io/en/latest/drivers/firefox.html#custom-binary-path Suggested-by: @allendema Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-01-28[refactor] typification of SearXNG (initial) / result items (part 1)Markus Heiser
Typification of SearXNG ======================= This patch introduces the typing of the results. The why and how is described in the documentation, please generate the documentation .. $ make docs.clean docs.live and read the following articles in the "Developer documentation": - result types --> http://0.0.0.0:8000/dev/result_types/index.html The result types are available from the `searx.result_types` module. The following have been implemented so far: - base result type: `searx.result_type.Result` --> http://0.0.0.0:8000/dev/result_types/base_result.html - answer results --> http://0.0.0.0:8000/dev/result_types/answer.html including the type for translations (inspired by #3925). For all other types (which still need to be set up in subsequent PRs), template documentation has been created for the transition period. Doc of the fields used in Templates =================================== The template documentation is the basis for the typing and is the first complete documentation of the results (needed for engine development). It is the "working paper" (the plan) with which further typifications can be implemented in subsequent PRs. - https://github.com/searxng/searxng/issues/357 Answer Templates ================ With the new (sub) types for `Answer`, the templates for the answers have also been revised, `Translation` are now displayed with collapsible entries (inspired by #3925). !en-de dog Plugins & Answerer ================== The implementation for `Plugin` and `Answer` has been revised, see documentation: - Plugin: http://0.0.0.0:8000/dev/plugins/index.html - Answerer: http://0.0.0.0:8000/dev/answerers/index.html With `AnswerStorage` and `AnswerStorage` to manage those items (in follow up PRs, `ArticleStorage`, `InfoStorage` and .. will be implemented) Autocomplete ============ The autocompletion had a bug where the results from `Answer` had not been shown in the past. To test activate autocompletion and try search terms for which we have answerers - statistics: type `min 1 2 3` .. in the completion list you should find an entry like `[de] min(1, 2, 3) = 1` - random: type `random uuid` .. in the completion list, the first item is a random UUID Extended Types ============== SearXNG extends e.g. the request and response types of flask and httpx, a module has been set up for type extensions: - Extended Types --> http://0.0.0.0:8000/dev/extended_types.html Unit-Tests ========== The unit tests have been completely revised. In the previous implementation, the runtime (the global variables such as `searx.settings`) was not initialized before each test, so the runtime environment with which a test ran was always determined by the tests that ran before it. This was also the reason why we sometimes had to observe non-deterministic errors in the tests in the past: - https://github.com/searxng/searxng/issues/2988 is one example for the Runtime issues, with non-deterministic behavior .. - https://github.com/searxng/searxng/pull/3650 - https://github.com/searxng/searxng/pull/3654 - https://github.com/searxng/searxng/pull/3642#issuecomment-2226884469 - https://github.com/searxng/searxng/pull/3746#issuecomment-2300965005 Why msgspec.Struct ================== We have already discussed typing based on e.g. `TypeDict` or `dataclass` in the past: - https://github.com/searxng/searxng/pull/1562/files - https://gist.github.com/dalf/972eb05e7a9bee161487132a7de244d2 - https://github.com/searxng/searxng/pull/1412/files - https://github.com/searxng/searxng/pull/1356 In my opinion, TypeDict is unsuitable because the objects are still dictionaries and not instances of classes / the `dataclass` are classes but ... The `msgspec.Struct` combine the advantages of typing, runtime behaviour and also offer the option of (fast) serializing (incl. type check) the objects. Currently not possible but conceivable with `msgspec`: Outsourcing the engines into separate processes, what possibilities this opens up in the future is left to the imagination! Internally, we have already defined that it is desirable to decouple the development of the engines from the development of the SearXNG core / The serialization of the `Result` objects is a prerequisite for this. HINT: The threads listed above were the template for this PR, even though the implementation here is based on msgspec. They should also be an inspiration for the following PRs of typification, as the models and implementations can provide a good direction. Why just one commit? ==================== I tried to create several (thematically separated) commits, but gave up at some point ... there are too many things to tackle at once / The comprehensibility of the commits would not be improved by a thematic separation. On the contrary, we would have to make multiple changes at the same places and the goal of a change would be vaguely recognizable in the fog of the commits. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-01-16[fix] build workflows of the themesMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-01-14[mod] slightly improve `make node.clean themes.all`Markus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-24[chore] *: fix typos detected by typos-cliBnyro
2024-10-10[mod] use quad9 dns for connectivity checks when lxcAllen
https://www.quad9.net/about/ https://bgp.tools/as/42#whois
2024-10-03[mod] py3.8 EOL / upgrade to actions/setup-python@v5Markus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-09-19[fix] scripts: elimination of limitations on dedicated distributionsMarkus Heiser
The restriction of shell scripts to certain distributions is only required for certain actions such as the installation of a SearXNG instance. The maintenance scripts and build processes were previously also restricted to these specific distributions. With this patch, the build processes (such as the build of online documentation) can now also be executed on all Linux distributions. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-08-21[fix] pip install -e: legacy editable install (setup.py develop) is deprecatedMarkus Heiser
From [1]: There is now a standardized mechanism [2] for an installer like pip to request an editable install of a project. pip is transitioning to using this standard only instead of invoking the deprecated `setup.py develop` command. For backward compatibility, we can use switches: --use-pep517 https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-use-pep517 --no-build-isolation https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-no-build-isolation - [1] https://github.com/pypa/pip/issues/11457 - [2] https://peps.python.org/pep-0660/ Closes: https://github.com/searxng/searxng/issues/3701 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-08-20[fix] debian/ubuntu python-is-python3Markus Heiser
Closes: https://github.com/searxng/searxng/issues/3235 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-06-07[feat] hostname replace plugin: possibility to prioritize certain websitesBnyro
Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
2024-05-09[fix] docutils dependencies (docutils>=0.21.2)Markus Heiser
Another trip into the hell of dependencies: docutils tends to put major changes in minor patches: the executables have been renamed / e.g. rst2html.py --> rts2html so we have to use docutils at least from version 0.21.2, but this version of docutils is only supported by myst-parser from version 3.0.1 on. Additionally, docutils decided to drop python 3.8 in version 0.21 [1] Further, linuxdoc needed an update to cope with docutils 0.21 [2] [1] https://docutils.sourceforge.io/RELEASE-NOTES.html#release-0-21-2024-04-09 [2] https://github.com/return42/linuxdoc/pull/36 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-03-11[mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTIONMarkus Heiser
In the past, some files were tested with the standard profile, others with a profile in which most of the messages were switched off ... some files were not checked at all. - ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished - the distinction ``# lint: pylint`` is no longer necessary - the pylint tasks have been reduced from three to two 1. ./searx/engines -> lint engines with additional builtins 2. ./searx ./searxng_extra ./tests -> lint all other python files Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-03-11[mod] pylint all engines without PYLINT_SEARXNG_DISABLE_OPTIONMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-03-09[mod] CI: tag commits with leading scope/type of the modificationMarkus Heiser
Add a leading tag (in square brackets) about the scope/type to commit messages from automated tasks (commits from CI). dependantbot:: [upd] pypi: Bump .. from .. to .. [upd] npm: Bump .. from .. to .. in /searx/static/themes/simple Weblate translation updates:: [l10n] update translations from Weblate updates of ./data:: [data] update searx.data ... build commit of gh-pages:: [doc] build from commit ... Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-02-20[fix] utils/searxng.sh uses searx.shared module which no longer existsKalokaK
Issue exists since #1954 has been merged / the PR fixed all searx.shared except this one fixed here in this commit. Related: https://github.com/searxng/searxng/pull/1954 Closes: https://github.com/searxng/searxng/issues/3224