-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[mod] container: refactor entrypoint script #4793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0e6b57c to
3f397bf
Compare
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 searxng#4721 (comment)
3f397bf to
1da2d14
Compare
| @@ -0,0 +1,166 @@ | |||
| #!/bin/sh | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of what type needs an docker-entry script to be? In the past (if I remember correctly) we used dash from alpine.
| - Alpine's ``/bin/sh`` is :man:`dash` |
Since most distros today install bash
searxng/docs/admin/installation-docker.rst
Lines 142 to 144 in 86373e7
| .. sidebar:: Bashism | |
| - `A tale of two shells: bash or dash <https://lwn.net/Articles/343924/>`_ |
and having bash and sh (dash) scripts in this repo makes writing scripts unneeded complicated ..
searxng/docs/admin/installation-docker.rst
Lines 145 to 146 in 86373e7
| - `How to make bash scripts work in dash <http://mywiki.wooledge.org/Bashism>`_ | |
| - `Checking for Bashisms <https://dev.to/bowmanjd/writing-bash-scripts-that-are-not-only-bash-checking-for-bashisms-and-testing-with-dash-1bli>`_ |
I would recommend to use bash whenever possible.
I suspect bash can be added here (?) ..
Lines 6 to 14 in 86373e7
| packages: | |
| - wolfi-baselayout | |
| - ca-certificates-bundle | |
| - busybox | |
| - python-3.13 | |
| # healthcheck | |
| - wget | |
| # uwsgi | |
| - mailcap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is ash, which is the shell provided by busybox. We don't require the use of bash, since we don't fiddle around inside the entrypoint. As it's a script that is only going to run in a container, we can save on interoperability.
inetol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI reports OK. (updated link)
Exec under Docker/Podman OK.
|
hello @inetol, I would recommend you to try your future changes on https://github.com/searxng/searxng-docker too because it was obvious that this PR broke the project. I am not against changing how things work, but maybe we could have done it a bit less harsh. Maybe by giving a head up/warning to everyone like 2-3 weeks in advance to remove the cap_drop and cap_add. Thanks :). |
container/entrypoint.sh before PR-4793 [1] there was a -h option which is used to generate documentation from [2] docs/dev/result_types/main_result.rst Fix typo: MainResult is the type for the default.html template [1] searxng#4793 [2] https://github.com/searxng/searxng/blob/d63bdcd773b/docs/admin/installation-docker.rst?plain=1#L190 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
The new Docker entrypoint.sh script implemented in PR: - searxng#4793 does no longer have a `-h` option [1]. When building the `make docs` a warming is shown:: WARNING: Unexpected return code 2 from command Command(command=('../container/entrypoint.sh', '-h') .. (output='../container/entrypoint.sh: 152: SEARXNG_VERSION: parameter not set') [1] https://github.com/searxng/searxng/pull/4793/files#diff-694a402a03e8de5aa227b1c0294ffdc072b6bac09b4dcbe144dc7d97d4e07159L35 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
The new Docker entrypoint.sh script implemented in PR: - #4793 does no longer have a `-h` option [1]. When building the `make docs` a warming is shown:: WARNING: Unexpected return code 2 from command Command(command=('../container/entrypoint.sh', '-h') .. (output='../container/entrypoint.sh: 152: SEARXNG_VERSION: parameter not set') [1] https://github.com/searxng/searxng/pull/4793/files#diff-694a402a03e8de5aa227b1c0294ffdc072b6bac09b4dcbe144dc7d97d4e07159L35 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
The new Docker entrypoint.sh script implemented in PR: - searxng#4793 does no longer have a `-h` option [1]. When building the `make docs` a warming is shown:: WARNING: Unexpected return code 2 from command Command(command=('../container/entrypoint.sh', '-h') .. (output='../container/entrypoint.sh: 152: SEARXNG_VERSION: parameter not set') [1] https://github.com/searxng/searxng/pull/4793/files#diff-694a402a03e8de5aa227b1c0294ffdc072b6bac09b4dcbe144dc7d97d4e07159L35 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
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.
This is the first step on making
searxnguser exec by default.Latest CI: https://github.com/inetol/searxng/actions/runs/15134094471
Related #4721 (comment)