on master help sign in
docs: generic doocumentation for searx-uwsgi
3cb7daeMarkus Heiser
docs/admin/installation-searx.rst+3−2
@@ -30,6 +30,9 @@ Create user
30 :start-after: START create user
30 :start-after: START create user
31 :end-before: END create user
31 :end-before: END create user
32
32
33+install searx & dependencies
34+============================
35+
33Start a interactive shell from new created user and clone searx:
36Start a interactive shell from new created user and clone searx:
34
37
35.. include:: ../../build/docs/includes/searx.rst
38.. include:: ../../build/docs/includes/searx.rst
@@ -55,7 +58,6 @@ from the login (*~/.profile*):
55 Open a second terminal for the configuration tasks and left the ``(searx)$``
58 Open a second terminal for the configuration tasks and left the ``(searx)$``
56 terminal open for the tasks below.
59 terminal open for the tasks below.
57
60
58−
59Configuration
61Configuration
60==============
62==============
61
63
@@ -67,7 +69,6 @@ a name of your choice -- *and/or* edit ``/etc/searx/settings.yml`` if necessary.
67 :start-after: START searx config
69 :start-after: START searx config
68 :end-before: END searx config
70 :end-before: END searx config
69
71
70−
71Check
72Check
72=====
73=====
73
74
docs/admin/installation-uwsgi.rst+31−57
@@ -4,79 +4,53 @@
4uwsgi
4uwsgi
5=====
5=====
6
6
7−Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
7+Create the configuration ini-file according to your distribution (see below) and
8−content:
8+restart the uwsgi application.
9
9
10−.. code:: ini
10+.. tabs::
11
11
12− [uwsgi]
12+ .. group-tab:: Ubuntu / debian
13
13
14− # uWSGI core
14+ .. literalinclude:: ../../build/docs/includes/searx.rst
15− # ----------
15+ :start-after: START searx uwsgi-description ubuntu-20.04
16− #
16+ :end-before: END searx uwsgi-description ubuntu-20.04
17− # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core
18
17
19− # Who will run the code
20− uid = searx
21− gid = searx
22
18
23− # chdir to specified directory before apps loading
19+ .. group-tab:: Arch Linux
24− chdir = /usr/local/searx/searx-src/searx
25
20
26− # disable logging for privacy
21+ .. literalinclude:: ../../build/docs/includes/searx.rst
27− disable-logging = true
22+ :start-after: START searx uwsgi-description arch
23+ :end-before: END searx uwsgi-description arch
28
24
29− # The right granted on the created socket
30− chmod-socket = 666
31
25
32− # Plugin to use and interpretor config
26+ .. group-tab:: Fedora / RHEL
33− single-interpreter = true
34
27
35− # enable master process
28+ .. literalinclude:: ../../build/docs/includes/searx.rst
36− master = true
29+ :start-after: START searx uwsgi-description fedora
30+ :end-before: END searx uwsgi-description fedora
37
31
38− # load apps in each worker instead of the master
39− lazy-apps = true
40
32
41− # load uWSGI plugins
33+.. tabs::
42− plugin = python3,http
43
34
44− # By default the Python plugin does not initialize the GIL. This means your
35+ .. group-tab:: Ubuntu / debian
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
50
36
51− # plugin: python
37+ .. literalinclude:: ../../build/docs/includes/searx.rst
52− # --------------
38+ :language: ini
53− #
39+ :start-after: START searx uwsgi-appini ubuntu-20.04
54− # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python
40+ :end-before: END searx uwsgi-appini ubuntu-20.04
55
41
56− # load a WSGI module
42+ .. group-tab:: Arch Linux
57− module = searx.webapp
58
43
59− # set PYTHONHOME/virtualenv
44+ .. literalinclude:: ../../build/docs/includes/searx.rst
60− virtualenv = /usr/local/searx/searx-pyenv
45+ :language: ini
46+ :start-after: START searx uwsgi-appini arch
47+ :end-before: END searx uwsgi-appini arch
61
48
62− # add directory (or glob) to pythonpath
49+ .. group-tab:: Fedora / RHEL
63− pythonpath = /usr/local/searx/searx-src
64
50
65−
51+ .. literalinclude:: ../../build/docs/includes/searx.rst
66− # plugin http
52+ :language: ini
67− # -----------
53+ :start-after: START searx uwsgi-appini fedora
68− #
54+ :end-before: END searx uwsgi-appini fedora
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
81
55
82
56
utils/lib.sh+32−28
@@ -708,35 +708,39 @@ uWSGI_GROUP=
708# How distros manage uWSGI apps is very different. From uWSGI POV read:
708# How distros manage uWSGI apps is very different. From uWSGI POV read:
709# - https://uwsgi-docs.readthedocs.io/en/latest/Management.html
709# - https://uwsgi-docs.readthedocs.io/en/latest/Management.html
710
710
711+uWSGI_distro_setup() {
711−case $DIST_ID-$DIST_VERS in
712+ case $DIST_ID-$DIST_VERS in
712− ubuntu-*|debian-*)
713+ ubuntu-*|debian-*)
713− # init.d --> /usr/share/doc/uwsgi/README.Debian.gz
714+ # init.d --> /usr/share/doc/uwsgi/README.Debian.gz
714− # For uWSGI debian uses the LSB init process, this might be changed
715+ # 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+ # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
716− uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
717+ uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
717− uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled"
718+ uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled"
718− ;;
719+ ;;
719− arch-*)
720+ arch-*)
720− # systemd --> /usr/lib/systemd/system/uwsgi@.service
721+ # systemd --> /usr/lib/systemd/system/uwsgi@.service
721− # For uWSGI archlinux uses systemd template units, see
722+ # For uWSGI archlinux uses systemd template units, see
722− # - http://0pointer.de/blog/projects/instances.html
723+ # - http://0pointer.de/blog/projects/instances.html
723− # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
724+ # - 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_AVAILABLE="${uWSGI_SETUP}/apps-archlinux"
725− uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
726+ uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
726− ;;
727+ ;;
727− fedora-*)
728+ fedora-*)
728− # systemd --> /usr/lib/systemd/system/uwsgi.service
729+ # systemd --> /usr/lib/systemd/system/uwsgi.service
729− # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
730+ # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
730− # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
731+ # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
731− uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
732+ uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
732− uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"
733+ uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"
733− uWSGI_USER="uwsgi"
734+ uWSGI_USER="uwsgi"
734− uWSGI_GROUP="uwsgi"
735+ uWSGI_GROUP="uwsgi"
735− ;;
736+ ;;
736− *)
737+ *)
737− info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
738+ info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
738− ;;
739+ ;;
739esac
740esac
741+}
742+
743+uWSGI_distro_setup
740
744
741uWSGI_restart() {
745uWSGI_restart() {
742
746
utils/searx.sh+30
@@ -645,8 +645,38 @@ rst-doc() {
645
645
646 eval "echo \"$(< ${REPO_ROOT}/docs/build-templates/searx.rst)\""
646 eval "echo \"$(< ${REPO_ROOT}/docs/build-templates/searx.rst)\""
647
647
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+
648}
677}
649
678
650# ----------------------------------------------------------------------------
679# ----------------------------------------------------------------------------
651main "$@"
680main "$@"
652# ----------------------------------------------------------------------------
681# ----------------------------------------------------------------------------
682+