mirror of
https://github.com/searxng/searxng.git
synced 2024-11-14 16:50:11 +01:00
docs: generic doocumentation for searx-uwsgi
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
f25da6070e
commit
3cb7daedb7
@ -30,6 +30,9 @@ Create user
|
|||||||
:start-after: START create user
|
:start-after: START create user
|
||||||
:end-before: END create user
|
:end-before: END create user
|
||||||
|
|
||||||
|
install searx & dependencies
|
||||||
|
============================
|
||||||
|
|
||||||
Start a interactive shell from new created user and clone searx:
|
Start a interactive shell from new created user and clone searx:
|
||||||
|
|
||||||
.. include:: ../../build/docs/includes/searx.rst
|
.. include:: ../../build/docs/includes/searx.rst
|
||||||
@ -55,7 +58,6 @@ from the login (*~/.profile*):
|
|||||||
Open a second terminal for the configuration tasks and left the ``(searx)$``
|
Open a second terminal for the configuration tasks and left the ``(searx)$``
|
||||||
terminal open for the tasks below.
|
terminal open for the tasks below.
|
||||||
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
==============
|
==============
|
||||||
|
|
||||||
@ -67,7 +69,6 @@ a name of your choice -- *and/or* edit ``/etc/searx/settings.yml`` if necessary.
|
|||||||
:start-after: START searx config
|
:start-after: START searx config
|
||||||
:end-before: END searx config
|
:end-before: END searx config
|
||||||
|
|
||||||
|
|
||||||
Check
|
Check
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
@ -4,79 +4,53 @@
|
|||||||
uwsgi
|
uwsgi
|
||||||
=====
|
=====
|
||||||
|
|
||||||
Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
|
Create the configuration ini-file according to your distribution (see below) and
|
||||||
content:
|
restart the uwsgi application.
|
||||||
|
|
||||||
.. code:: ini
|
.. tabs::
|
||||||
|
|
||||||
[uwsgi]
|
.. group-tab:: Ubuntu / debian
|
||||||
|
|
||||||
# uWSGI core
|
.. literalinclude:: ../../build/docs/includes/searx.rst
|
||||||
# ----------
|
:start-after: START searx uwsgi-description ubuntu-20.04
|
||||||
#
|
:end-before: END searx uwsgi-description ubuntu-20.04
|
||||||
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core
|
|
||||||
|
|
||||||
# Who will run the code
|
|
||||||
uid = searx
|
|
||||||
gid = searx
|
|
||||||
|
|
||||||
# chdir to specified directory before apps loading
|
|
||||||
chdir = /usr/local/searx/searx-src/searx
|
|
||||||
|
|
||||||
# disable logging for privacy
|
|
||||||
disable-logging = true
|
|
||||||
|
|
||||||
# The right granted on the created socket
|
|
||||||
chmod-socket = 666
|
|
||||||
|
|
||||||
# Plugin to use and interpretor config
|
|
||||||
single-interpreter = true
|
|
||||||
|
|
||||||
# enable master process
|
|
||||||
master = true
|
|
||||||
|
|
||||||
# load apps in each worker instead of the master
|
|
||||||
lazy-apps = true
|
|
||||||
|
|
||||||
# load uWSGI plugins
|
|
||||||
plugin = python3,http
|
|
||||||
|
|
||||||
# By default the Python plugin does not initialize the GIL. This means your
|
|
||||||
# app-generated threads will not run. If you need threads, remember to enable
|
|
||||||
# them with enable-threads. Running uWSGI in multithreading mode (with the
|
|
||||||
# threads options) will automatically enable threading support. This *strange*
|
|
||||||
# default behaviour is for performance reasons.
|
|
||||||
enable-threads = true
|
|
||||||
|
|
||||||
# plugin: python
|
|
||||||
# --------------
|
|
||||||
#
|
|
||||||
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python
|
|
||||||
|
|
||||||
# load a WSGI module
|
|
||||||
module = searx.webapp
|
|
||||||
|
|
||||||
# set PYTHONHOME/virtualenv
|
|
||||||
virtualenv = /usr/local/searx/searx-pyenv
|
|
||||||
|
|
||||||
# add directory (or glob) to pythonpath
|
|
||||||
pythonpath = /usr/local/searx/searx-src
|
|
||||||
|
|
||||||
|
|
||||||
# plugin http
|
.. group-tab:: Arch Linux
|
||||||
# -----------
|
|
||||||
#
|
|
||||||
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http
|
|
||||||
|
|
||||||
# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html
|
.. literalinclude:: ../../build/docs/includes/searx.rst
|
||||||
http = 127.0.0.1:8888
|
:start-after: START searx uwsgi-description arch
|
||||||
|
:end-before: END searx uwsgi-description arch
|
||||||
Activate the uwsgi application and restart:
|
|
||||||
|
|
||||||
.. code:: sh
|
.. group-tab:: Fedora / RHEL
|
||||||
|
|
||||||
cd /etc/uwsgi/apps-enabled
|
.. literalinclude:: ../../build/docs/includes/searx.rst
|
||||||
ln -s ../apps-available/searx.ini
|
:start-after: START searx uwsgi-description fedora
|
||||||
/etc/init.d/uwsgi restart
|
:end-before: END searx uwsgi-description fedora
|
||||||
|
|
||||||
|
|
||||||
|
.. tabs::
|
||||||
|
|
||||||
|
.. group-tab:: Ubuntu / debian
|
||||||
|
|
||||||
|
.. literalinclude:: ../../build/docs/includes/searx.rst
|
||||||
|
:language: ini
|
||||||
|
:start-after: START searx uwsgi-appini ubuntu-20.04
|
||||||
|
:end-before: END searx uwsgi-appini ubuntu-20.04
|
||||||
|
|
||||||
|
.. group-tab:: Arch Linux
|
||||||
|
|
||||||
|
.. literalinclude:: ../../build/docs/includes/searx.rst
|
||||||
|
:language: ini
|
||||||
|
:start-after: START searx uwsgi-appini arch
|
||||||
|
:end-before: END searx uwsgi-appini arch
|
||||||
|
|
||||||
|
.. group-tab:: Fedora / RHEL
|
||||||
|
|
||||||
|
.. literalinclude:: ../../build/docs/includes/searx.rst
|
||||||
|
:language: ini
|
||||||
|
:start-after: START searx uwsgi-appini fedora
|
||||||
|
:end-before: END searx uwsgi-appini fedora
|
||||||
|
|
||||||
|
|
||||||
|
60
utils/lib.sh
60
utils/lib.sh
@ -708,35 +708,39 @@ uWSGI_GROUP=
|
|||||||
# How distros manage uWSGI apps is very different. From uWSGI POV read:
|
# How distros manage uWSGI apps is very different. From uWSGI POV read:
|
||||||
# - https://uwsgi-docs.readthedocs.io/en/latest/Management.html
|
# - https://uwsgi-docs.readthedocs.io/en/latest/Management.html
|
||||||
|
|
||||||
case $DIST_ID-$DIST_VERS in
|
uWSGI_distro_setup() {
|
||||||
ubuntu-*|debian-*)
|
case $DIST_ID-$DIST_VERS in
|
||||||
# init.d --> /usr/share/doc/uwsgi/README.Debian.gz
|
ubuntu-*|debian-*)
|
||||||
# For uWSGI debian uses the LSB init process, this might be changed
|
# init.d --> /usr/share/doc/uwsgi/README.Debian.gz
|
||||||
# one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
|
# For uWSGI debian uses the LSB init process, this might be changed
|
||||||
uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
|
# one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
|
||||||
uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled"
|
uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
|
||||||
;;
|
uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled"
|
||||||
arch-*)
|
;;
|
||||||
# systemd --> /usr/lib/systemd/system/uwsgi@.service
|
arch-*)
|
||||||
# For uWSGI archlinux uses systemd template units, see
|
# systemd --> /usr/lib/systemd/system/uwsgi@.service
|
||||||
# - http://0pointer.de/blog/projects/instances.html
|
# For uWSGI archlinux uses systemd template units, see
|
||||||
# - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
|
# - http://0pointer.de/blog/projects/instances.html
|
||||||
uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-archlinux"
|
# - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
|
||||||
uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
|
uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-archlinux"
|
||||||
;;
|
uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
|
||||||
fedora-*)
|
;;
|
||||||
# systemd --> /usr/lib/systemd/system/uwsgi.service
|
fedora-*)
|
||||||
# The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
|
# systemd --> /usr/lib/systemd/system/uwsgi.service
|
||||||
# - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
|
# The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
|
||||||
uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
|
# - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
|
||||||
uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"
|
uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
|
||||||
uWSGI_USER="uwsgi"
|
uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"
|
||||||
uWSGI_GROUP="uwsgi"
|
uWSGI_USER="uwsgi"
|
||||||
;;
|
uWSGI_GROUP="uwsgi"
|
||||||
*)
|
;;
|
||||||
info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
|
*)
|
||||||
;;
|
info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
uWSGI_distro_setup
|
||||||
|
|
||||||
uWSGI_restart() {
|
uWSGI_restart() {
|
||||||
|
|
||||||
|
@ -645,8 +645,38 @@ rst-doc() {
|
|||||||
|
|
||||||
eval "echo \"$(< ${REPO_ROOT}/docs/build-templates/searx.rst)\""
|
eval "echo \"$(< ${REPO_ROOT}/docs/build-templates/searx.rst)\""
|
||||||
|
|
||||||
|
# I use ubuntu-20.04 here to demonstrate that versions are also suported,
|
||||||
|
# normaly debian-* and ubuntu-* are most the same.
|
||||||
|
|
||||||
|
for DIST_NAME in ubuntu-20.04 arch fedora; do
|
||||||
|
(
|
||||||
|
DIST_ID=${DIST_NAME%-*}
|
||||||
|
DIST_VERS=${DIST_NAME#*-}
|
||||||
|
[[ $DIST_VERS =~ $DIST_ID ]] && DIST_VERS=
|
||||||
|
uWSGI_distro_setup
|
||||||
|
|
||||||
|
echo -e "\n.. START searx uwsgi-description $DIST_NAME"
|
||||||
|
echo "location: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}"
|
||||||
|
case $DIST_ID-$DIST_VERS in
|
||||||
|
ubuntu-*|debian-*)
|
||||||
|
echo "restart: sudo -H service uwsgi restart ${SEARX_UWSGI_APP%.*}" ;;
|
||||||
|
arch-*)
|
||||||
|
echo "restart: sudo -H systemctl restart uwsgi@${SEARX_UWSGI_APP%.*}" ;;
|
||||||
|
fedora-*)
|
||||||
|
echo "restart: sudo -H touch ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}";;
|
||||||
|
esac
|
||||||
|
echo -e ".. END searx uwsgi-description $DIST_NAME"
|
||||||
|
|
||||||
|
echo -e "\n.. START searx uwsgi-appini $DIST_NAME"
|
||||||
|
eval "echo \"$(< ${TEMPLATES}/${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP})\""
|
||||||
|
echo -e "\n.. END searx uwsgi-appini $DIST_NAME"
|
||||||
|
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
main "$@"
|
main "$@"
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user