SearXNG doesn't load the settings ...
from maki@discuss.tchncs.de to selfhosted@lemmy.world on 05 Oct 00:38
https://discuss.tchncs.de/post/46262733

Hello,

After finally getting SearXNG to start with Podman, I wanted to adjust the configuration.

So I logged into the container and used vi to edit the settings.yml file, which is loaded when the container is first started. The container then stored these settings accordingly.

$podman exec -it searxng /bin/sh /usr/local/searxng # vi /etc/searxng/settings.yml

Extract

general:

Debug mode, only for development. Is overwritten by ${SEARXNG_DEBUG}

debug: false

displayed name

instance_name: "Test SearXNG"

For example: example.com/privacy

privacypolicy_url: false

use true to use your own donation page written in searx/info/en/donate.md

use false to disable the donation link

donation_url: false

mailto:contact@example.com

contact_url: true

record stats

enable_metrics: true

expose stats in open metrics format at /metric

saved and another restart

$podman restart searxng

I then checked again as described above to see if the configuration was still there after the restart. It was still there.

Unfortunately, however, the name SearXNG is still used in the title, which means that the configuration is not loaded.

Since I was stuck, I decided to ask ChatGPT. I was then told to replace the pod with

podman run -d --name searxng
-p 0.0.0.0:5234:8080
-e SEARXNG_BASE_URL=192.168.4.15:5234
-e SEARXNG_SECRET=dfsj323qjwkjqfjadkj
-e SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml
–uidmap +$(id -u):977:1 --gidmap +$(id -g):977:1 --user=0:0
-v /opt/podman/searxng/config:/etc/searxng:Z
ghcr.io/searxng/searxng:latest
python3 -m searx

Unfortunately, this did not help. Another recommendation was to edit the template in the container. That might work until the next version, but I still won’t be able to configure anything.

Does anyone have any idea how I can get SearXNG to load the configuration?

#selfhosted

threaded - newest

mbirth@lemmy.ml on 05 Oct 01:14 next collapse

The important bit is -v /opt/podman/searxng/config:/etc/searxng:Z in the podman call. This will mount your local directory (i.e. on the host the container is running on) /opt/podman/searxng/config into the container as /etc/searxng (which is where SearXNG is searching for its config). Make sure that the local directory exists and is writeable by your user account before starting the container. This way your config will persist even when the container gets replaced by an updated version.

IIRC, after running the container for the first time, SearXNG should put a settings.yml and uwsgi.ini there. You can edit them and restart the container for the changes to take.

On later container updates, SearXNG will put the latest versions of the default configs as settings.yml.new and uwsgi.ini.new. This way it doesn’t overwrite your config and allows you to manually merge the new defaults into your running config. (If you only see the *.new files after starting the container for the first time, rename them and remove the .new part.)

elvith@feddit.org on 05 Oct 07:28 next collapse

uwsgi isn’t used anymore since a change from about 2 months ago IIRC, so this file will probably not be created.

mbirth@lemmy.ml on 05 Oct 12:05 collapse

Ah, gut zu wissen! Danke! :)

maki@discuss.tchncs.de on 06 Oct 20:52 collapse

Thank you!

podman run -d
–name searxng
-p 5234:8080
-e GRANIAN_WORKERS=1
-e GRANIAN_BLOCKING_THREADS=1
-e GRANIAN_BLOCKING_THREADS_IDLE_TIMEOUT=5m
–uidmap +$(id -u):977:1 --gidmap +$(id -g):977:1 --user=0:0
-v /opt/podman/searxng/config:/etc/searxng:Z
-v /opt/podman/searxng/data:/var/cache/searxng:Z
ghcr.io/searxng/searxng:latest

Now it runs and load the settings. But the owner of the file isn’t my user, it is 525265

ls -l
-rw-r–r–. 1 525265 525265 70044 Oct 6 11:52 settings.yml

I can edit this file as root.

30p87@feddit.org on 05 Oct 06:05 next collapse

Love how all “just works”-app debugging is just debugging the overly complicated and annoying container/-engine.

nottelling@lemmy.world on 05 Oct 13:31 next collapse

At some point you had to learn all about debugging the overly-complicated and annoying OS that runs your full installs, didn’t you?

30p87@feddit.org on 05 Oct 13:43 collapse

No, knowing literally “systemctl enable --now” and “journalctl -ru” is not even learning. The level of knowledge of the OS needed for running a native package vs a container is exactly the same.

MangoPenguin@lemmy.blahaj.zone on 05 Oct 16:51 collapse

Nah there’s no debugging here, just edit the config file on the host where it’s stored exactly like you would on a native install.

InnerScientist@lemmy.world on 05 Oct 06:46 next collapse

Did you follow the guide?

docs.searxng.org/admin/installation-docker.html#i…

maki@discuss.tchncs.de on 06 Oct 20:54 collapse

Yes, but I have to add this

–uidmap +$(id -u):977:1 --gidmap +$(id -g):977:1 --user=0:0
-v /opt/podman/searxng/config:/etc/searxng:Z
-v /opt/podman/searxng/data:/var/cache/searxng:Z
elvith@feddit.org on 05 Oct 07:34 next collapse

I’m also using podman to host SearXNG on a cloud vps. If you’d like, I can provide you my quadlet and config files to get it running with podman’s systemd generator.

With those you can just systemctl enable/disable/start/stop/restart searxng. Also my files do have podman’s auto update activated for the SearXNG stack.

Edit: There’s also a matrix room for SearXNG if you need help: matrix.to/#/#searxng:matrix.org

elvith@feddit.org on 05 Oct 21:48 collapse

@maki@discuss.tchncs.de - I finally got around to be on my PC, so… Maybe this helps? Thats basically my setup on podman. I hope I didn’t break anything, when I scrubbed the files from secrets and also removed everything related to all other deployments (especially the Caddyfile). See the included Instructions.md

gist.github.com/…/fecd13bb05209fb7abf5ae473483534…

nottelling@lemmy.world on 05 Oct 13:27 next collapse

per the searxng container instructions:

‘’’ Understanding container architecture basics is essential for properly maintaining your SearXNG instance. This guide assumes familiarity with container concepts and provides deployment steps at a high level. ‘’’

The fact that you’re logging into your container to manually edit your config hints that you need to read more about managing containers.

Make sure you’re editing the file that you’re mounting on the host, and edit it from the host.

Have you checked the actual log with podman logs? It’ll tell you what it’s doing about its config.

maki@discuss.tchncs.de on 06 Oct 11:10 collapse

Thank you. I had some problems in the past with die user permission in the container and on the host. now it works, but i wasn’t sure, that the container use the right file, so I habe logged in.

MangoPenguin@lemmy.blahaj.zone on 05 Oct 16:52 collapse

Don’t log in to the container shell to edit files, just edit the file on your host directly.

Make sure the permissions allow the user searxng is running as access as well.

maki@discuss.tchncs.de on 06 Oct 11:10 collapse

thank you, it works fine.