on master help sign in
docs: generic doocumentation for searx-uwsgi

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commit3cb7daedb7c5c93a98dfefa191c161f31a1347c6 authorMarkus Heiser <markus.heiser@darmarit.de> dateTue 3 Mar 2020, 19:57 (7 years ago) parentf25da60
4 files changed+96−87
docs/admin/installation-searx.rst+3−2 docs/admin/installation-uwsgi.rst+31−57 utils/lib.sh+32−28 utils/searx.sh+30
docs/admin/installation-searx.rst+3−2
@@ -30,6 +30,9 @@ Create user
3030 :start-after: START create user
3131 :end-before: END create user
3232
33+install searx & dependencies
34+============================
35+
3336Start a interactive shell from new created user and clone searx:
3437
3538.. include:: ../../build/docs/includes/searx.rst
@@ -55,7 +58,6 @@ from the login (*~/.profile*):
5558 Open a second terminal for the configuration tasks and left the ``(searx)$``
5659 terminal open for the tasks below.
5760
58−
5961Configuration
6062==============
6163
@@ -67,7 +69,6 @@ a name of your choice -- *and/or* edit ``/etc/searx/settings.yml`` if necessary.
6769 :start-after: START searx config
6870 :end-before: END searx config
6971
70−
7172Check
7273=====
7374
docs/admin/installation-uwsgi.rst+31−57
@@ -4,79 +4,53 @@
44uwsgi
55=====
66
7−Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
8−content:
7+Create the configuration ini-file according to your distribution (see below) and
8+restart the uwsgi application.
99
10−.. code:: ini
10+.. tabs::
1111
12− [uwsgi]
12+ .. group-tab:: Ubuntu / debian
1313
14− # uWSGI core
15− # ----------
16− #
17− # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core
14+ .. literalinclude:: ../../build/docs/includes/searx.rst
15+ :start-after: START searx uwsgi-description ubuntu-20.04
16+ :end-before: END searx uwsgi-description ubuntu-20.04
1817
19− # Who will run the code
20− uid = searx
21− gid = searx
2218
23− # chdir to specified directory before apps loading
24− chdir = /usr/local/searx/searx-src/searx
19+ .. group-tab:: Arch Linux
2520
26− # disable logging for privacy
27− disable-logging = true
21+ .. literalinclude:: ../../build/docs/includes/searx.rst
22+ :start-after: START searx uwsgi-description arch
23+ :end-before: END searx uwsgi-description arch
2824
29− # The right granted on the created socket
30− chmod-socket = 666
3125
32− # Plugin to use and interpretor config
33− single-interpreter = true
26+ .. group-tab:: Fedora / RHEL
3427
35− # enable master process
36− master = true
28+ .. literalinclude:: ../../build/docs/includes/searx.rst
29+ :start-after: START searx uwsgi-description fedora
30+ :end-before: END searx uwsgi-description fedora
3731
38− # load apps in each worker instead of the master
39− lazy-apps = true
4032
41− # load uWSGI plugins
42− plugin = python3,http
33+.. tabs::
4334
44− # By default the Python plugin does not initialize the GIL. This means your
45− # app-generated threads will not run. If you need threads, remember to enable
46− # them with enable-threads. Running uWSGI in multithreading mode (with the
47− # threads options) will automatically enable threading support. This *strange*
48− # default behaviour is for performance reasons.
49− enable-threads = true
35+ .. group-tab:: Ubuntu / debian
5036
51− # plugin: python
52− # --------------
53− #
54− # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python
37+ .. literalinclude:: ../../build/docs/includes/searx.rst
38+ :language: ini
39+ :start-after: START searx uwsgi-appini ubuntu-20.04
40+ :end-before: END searx uwsgi-appini ubuntu-20.04
5541
56− # load a WSGI module
57− module = searx.webapp
42+ .. group-tab:: Arch Linux
5843
59− # set PYTHONHOME/virtualenv
60− virtualenv = /usr/local/searx/searx-pyenv
44+ .. literalinclude:: ../../build/docs/includes/searx.rst
45+ :language: ini
46+ :start-after: START searx uwsgi-appini arch
47+ :end-before: END searx uwsgi-appini arch
6148
62− # add directory (or glob) to pythonpath
63− pythonpath = /usr/local/searx/searx-src
49+ .. group-tab:: Fedora / RHEL
6450
65−
66− # plugin http
67− # -----------
68− #
69− # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http
70−
71− # Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html
72− http = 127.0.0.1:8888
73−
74−Activate the uwsgi application and restart:
75−
76−.. code:: sh
77−
78− cd /etc/uwsgi/apps-enabled
79− ln -s ../apps-available/searx.ini
80− /etc/init.d/uwsgi restart
51+ .. literalinclude:: ../../build/docs/includes/searx.rst
52+ :language: ini
53+ :start-after: START searx uwsgi-appini fedora
54+ :end-before: END searx uwsgi-appini fedora
8155
8256
utils/lib.sh+32−28
@@ -708,35 +708,39 @@ uWSGI_GROUP=
708708# How distros manage uWSGI apps is very different. From uWSGI POV read:
709709# - https://uwsgi-docs.readthedocs.io/en/latest/Management.html
710710
711−case $DIST_ID-$DIST_VERS in
712− ubuntu-*|debian-*)
713− # init.d --> /usr/share/doc/uwsgi/README.Debian.gz
714− # For uWSGI debian uses the LSB init process, this might be changed
715− # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
716− uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
717− uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled"
718− ;;
719− arch-*)
720− # systemd --> /usr/lib/systemd/system/uwsgi@.service
721− # For uWSGI archlinux uses systemd template units, see
722− # - http://0pointer.de/blog/projects/instances.html
723− # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
724− uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-archlinux"
725− uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
726− ;;
727− fedora-*)
728− # systemd --> /usr/lib/systemd/system/uwsgi.service
729− # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
730− # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
731− uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
732− uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"
733− uWSGI_USER="uwsgi"
734− uWSGI_GROUP="uwsgi"
735− ;;
736− *)
737− info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
738− ;;
711+uWSGI_distro_setup() {
712+ case $DIST_ID-$DIST_VERS in
713+ ubuntu-*|debian-*)
714+ # init.d --> /usr/share/doc/uwsgi/README.Debian.gz
715+ # For uWSGI debian uses the LSB init process, this might be changed
716+ # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
717+ uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
718+ uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled"
719+ ;;
720+ arch-*)
721+ # systemd --> /usr/lib/systemd/system/uwsgi@.service
722+ # For uWSGI archlinux uses systemd template units, see
723+ # - http://0pointer.de/blog/projects/instances.html
724+ # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
725+ uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-archlinux"
726+ uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
727+ ;;
728+ fedora-*)
729+ # systemd --> /usr/lib/systemd/system/uwsgi.service
730+ # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
731+ # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
732+ uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
733+ uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"
734+ uWSGI_USER="uwsgi"
735+ uWSGI_GROUP="uwsgi"
736+ ;;
737+ *)
738+ info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
739+ ;;
739740esac
741+}
742+
743+uWSGI_distro_setup
740744
741745uWSGI_restart() {
742746
utils/searx.sh+30
@@ -645,8 +645,38 @@ rst-doc() {
645645
646646 eval "echo \"$(< ${REPO_ROOT}/docs/build-templates/searx.rst)\""
647647
648+ # I use ubuntu-20.04 here to demonstrate that versions are also suported,
649+ # normaly debian-* and ubuntu-* are most the same.
650+
651+ for DIST_NAME in ubuntu-20.04 arch fedora; do
652+ (
653+ DIST_ID=${DIST_NAME%-*}
654+ DIST_VERS=${DIST_NAME#*-}
655+ [[ $DIST_VERS =~ $DIST_ID ]] && DIST_VERS=
656+ uWSGI_distro_setup
657+
658+ echo -e "\n.. START searx uwsgi-description $DIST_NAME"
659+ echo "location: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}"
660+ case $DIST_ID-$DIST_VERS in
661+ ubuntu-*|debian-*)
662+ echo "restart: sudo -H service uwsgi restart ${SEARX_UWSGI_APP%.*}" ;;
663+ arch-*)
664+ echo "restart: sudo -H systemctl restart uwsgi@${SEARX_UWSGI_APP%.*}" ;;
665+ fedora-*)
666+ echo "restart: sudo -H touch ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}";;
667+ esac
668+ echo -e ".. END searx uwsgi-description $DIST_NAME"
669+
670+ echo -e "\n.. START searx uwsgi-appini $DIST_NAME"
671+ eval "echo \"$(< ${TEMPLATES}/${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP})\""
672+ echo -e "\n.. END searx uwsgi-appini $DIST_NAME"
673+
674+ )
675+ done
676+
648677}
649678
650679# ----------------------------------------------------------------------------
651680main "$@"
652681# ----------------------------------------------------------------------------
682+