searxng / searxng-docker

The docker-compose files for setting up a SearXNG instance with docker.
GNU Affero General Public License v3.0
1.01k stars 247 forks source link

Include missing uwsgi.ini #238

Open impaktor opened 4 weeks ago

impaktor commented 4 weeks ago

There is probably a reason why this file is in the gitignore, and not included in the source tree, but I'm opening this PR to start discussion on proper fix, as the docker compose doesn't work without it.

Possible fixes:

  1. Accept this PR and merge
  2. Add the file to project's root directory (or elsewhere) and update README that the file should be copied into proper location

This fixes #115

inetol commented 4 weeks ago

These files should be created when you start the SearXNG container and not included in this repository.

You can try changing the local path of the volume to a folder inside the home folder of the user running the container so that it has the necessary permissions, like so:

volumes:
    - ./searxng:/home/myuser/searxng:rw
AlyoshaVasilieva commented 3 weeks ago

chown -R root:root searxng-docker (or whatever dir you have it in)

SearXNG docker only works properly if every file is owned by root for some reason. If you follow the repo instructions closely and put it inside /usr/local you likely already did this since normal users can't write there, at least on Debian.

ppfeufer commented 3 weeks ago

SearXNG docker only works properly if every file is owned by root for some reason.

That is not correct at all image

Your user just needs to be in the docker group … And yes, the uwsgi.ini file is created.

AlyoshaVasilieva commented 3 weeks ago

I don't put my user in docker group. Is it an expected part of Docker installs?

impaktor commented 3 weeks ago

I don't put my user in docker group. Is it an expected part of Docker installs?

Yes. However, I am in the docker user group, and did not get the uwsgi.ini file.

ppfeufer commented 3 weeks ago

Make sure you have this in your docker-compose.yml file for the searxng section.

    volumes:
      - ./searxng:/etc/searxng:rw

(https://github.com/searxng/searxng-docker/blob/master/docker-compose.yaml#L55-L56)

This will create a searxng directory in your docker directory and map /etc/searxng from inside the searxng container to it. This should include the uwsgi.ini file.

If in doubt and you already have that directory, stop your containers, rename that directory and start your containers again. That way it should re-create the directory and put all the files in it. You can then copy the settings from the renamed directory in there and restart the whole show, so you won't lose any settings or the like.

EDIT: Just tested this and the uwsgi.ini file is there. image

With this being the relevant log:

searxng    | SearXNG version 2024.6.7+f5eb56b63
searxng    | Use existing /etc/searxng/uwsgi.ini
searxng    | Use existing /etc/searxng/settings.yml
searxng    | Listen on 0.0.0.0:8080
searxng    | [uWSGI] getting INI configuration from /etc/searxng/uwsgi.ini
searxng    | [uwsgi-static] added mapping for /static => /usr/local/searxng/searx/static
impaktor commented 3 weeks ago

SearXNG docker only works properly if every file is owned by root for some reason. If you follow the repo instructions closely and put it inside /usr/local you likely already did this since normal users can't write there, at least on Debian.

Looking at the README I'd venture it's highly implicit that the folder must be root, as anyone following the README, will get an error when running git clone on /usr/local as they're likely not defaulting to being root in their terminals. They will then either git clone into whatever folder they already have in /home where they usually put all their git cloned repos, or they will go full John Wayne and "sudo git clone" right there in /usr/local, which to me feels unnatural, which is why I opted for putting it in my home dir.

way forward

Either way, I'd argue some change is needed. E.g. explicitly add the chown root:rotot -R command, to indicate where ever the user puts it, this repo should run as root, or include the uwsgi file, or some other change?

ppfeufer commented 3 weeks ago

Or installing it in /usr/local is wrong in the first place. At least I can't find a good reason to have it there. I installed it in my user's home directory and didn't have to chown anything.