on master help sign in
docs: generic documentation from the installation scripts

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

commitc3e4753ce951f759844db13d98f9ad5b226f84b6 authorMarkus Heiser <markus.heiser@darmarit.de> dateMon 2 Mar 2020, 19:00 (7 years ago) parent491cb95
13 files changed+484−241
Makefile+10−2 docs/admin/index.rst+4 docs/admin/installation-docker.rst+28 docs/admin/installation-searx.rst+85 docs/admin/installation-uwsgi.rst+82 docs/admin/installation.rst+38−209 docs/admin/update-searx.rst+23 docs/utils/index.rst−9 utils/filtron.sh+4 utils/lib.sh+6−2 utils/lxc.sh+5 utils/morty.sh+4 utils/searx.sh+195−19
Makefile+10−2
@@ -60,13 +60,21 @@ run: pyenvinstall
6060# ----
6161
6262PHONY += docs
63−docs: pyenvinstall sphinx-doc
63+
64+docs: pyenvinstall sphinx-doc prebuild-includes
6465 $(call cmd,sphinx,html,docs,docs)
6566
6667PHONY += docs-live
67−docs-live: pyenvinstall sphinx-live
68+docs-live: pyenvinstall sphinx-live prebuild-includes
6869 $(call cmd,sphinx_autobuild,html,docs,docs)
6970
71+prebuild-includes:
72+ @mkdir -p $(DOCS_BUILD)/includes
73+ @./utils/searx.sh doc | cat > $(DOCS_BUILD)/includes/searx.rst
74+ @./utils/filtron.sh doc | cat > $(DOCS_BUILD)/includes/filtron.rst
75+ @./utils/morty.sh doc | cat > $(DOCS_BUILD)/includes/morty.rst
76+
77+
7078$(GH_PAGES)::
7179 @echo "doc available at --> $(DOCS_URL)"
7280
docs/admin/index.rst+4
@@ -7,8 +7,12 @@ Administrator documentation
77 :caption: Contents
88
99 installation
10+ installation-searx
11+ installation-uwsgi
1012 installation-nginx
1113 installation-apache
14+ installation-docker
15+ update-searx
1216 settings
1317 api
1418 architecture
docs/admin/installation-docker.rstnew file+28
@@ -0,0 +1,28 @@
1+.. _installation docker:
2+
3+===================
4+Docker installation
5+===================
6+
7+.. contents:: Contents
8+ :depth: 2
9+ :local:
10+ :backlinks: entry
11+
12+Make sure you have installed Docker. For instance, you can deploy searx like this:
13+
14+.. code:: sh
15+
16+ docker pull wonderfall/searx
17+ docker run -d --name searx -p $PORT:8888 wonderfall/searx
18+
19+Go to ``http://localhost:$PORT``.
20+
21+See https://hub.docker.com/r/wonderfall/searx/ for more informations. It's also
22+possible to build searx from the embedded Dockerfile.
23+
24+.. code:: sh
25+
26+ git clone https://github.com/asciimoo/searx.git
27+ cd searx
28+ docker build -t whatever/searx .
docs/admin/installation-searx.rstnew file+85
@@ -0,0 +1,85 @@
1+.. _installation basic:
2+
3+=========================
4+Step by step installation
5+=========================
6+
7+.. contents:: Contents
8+ :depth: 2
9+ :local:
10+ :backlinks: entry
11+
12+Step by step installation with virtualenv. For Ubuntu, be sure to have enable
13+universe repository.
14+
15+Install packages
16+================
17+
18+.. include:: ../../build/docs/includes/searx.rst
19+ :start-after: START distro-packages
20+ :end-before: END distro-packages
21+
22+.. hint::
23+
24+ This installs also the packages needed by :ref:`searx uwsgi`
25+
26+Create user
27+===========
28+
29+.. include:: ../../build/docs/includes/searx.rst
30+ :start-after: START create user
31+ :end-before: END create user
32+
33+Start a interactive shell from new created user and clone searx:
34+
35+.. include:: ../../build/docs/includes/searx.rst
36+ :start-after: START clone searx
37+ :end-before: END clone searx
38+
39+In the same shell create *virtualenv*:
40+
41+.. include:: ../../build/docs/includes/searx.rst
42+ :start-after: START create virtualenv
43+ :end-before: END create virtualenv
44+
45+To install searx's dependencies, exit the searx *bash* session you opened above
46+and restart a new. Before install, first check if your *virualenv* was sourced
47+from the login (*~/.profile*):
48+
49+.. include:: ../../build/docs/includes/searx.rst
50+ :start-after: START manage.sh update_packages
51+ :end-before: END manage.sh update_packages
52+
53+.. tip::
54+
55+ Open a second terminal for the configuration tasks and left the ``(searx)$``
56+ terminal open for the tasks below.
57+
58+
59+Configuration
60+==============
61+
62+Create a copy of the :origin:`searx/settings.yml` configuration file in system's
63+*/etc* folder. Configure like shown below -- replace ``searx@\$(uname -n)`` with
64+a name of your choice -- *and/or* edit ``/etc/searx/settings.yml`` if necessary.
65+
66+.. include:: ../../build/docs/includes/searx.rst
67+ :start-after: START searx config
68+ :end-before: END searx config
69+
70+
71+Check
72+=====
73+
74+To check your searx setup, optional enable debugging and start the *webapp*.
75+Searx looks at the exported environment ``$SEARX_SETTINGS_PATH`` for a
76+configuration file.
77+
78+.. include:: ../../build/docs/includes/searx.rst
79+ :start-after: START check searx installation
80+ :end-before: END check searx installation
81+
82+If everything works fine, hit ``[CTRL-C]`` to stop the *webapp* and disable the
83+debug option in ``settings.yml``. You can now exit searx user bash (enter exit
84+command twice). At this point searx is not demonized; uwsgi allows this.
85+
docs/admin/installation-uwsgi.rstnew file+82
@@ -0,0 +1,82 @@
1+.. _searx uwsgi:
2+
3+=====
4+uwsgi
5+=====
6+
7+Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
8+content:
9+
10+.. code:: ini
11+
12+ [uwsgi]
13+
14+ # uWSGI core
15+ # ----------
16+ #
17+ # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core
18+
19+ # Who will run the code
20+ uid = searx
21+ gid = searx
22+
23+ # chdir to specified directory before apps loading
24+ chdir = /usr/local/searx/searx-src/searx
25+
26+ # disable logging for privacy
27+ disable-logging = true
28+
29+ # The right granted on the created socket
30+ chmod-socket = 666
31+
32+ # Plugin to use and interpretor config
33+ single-interpreter = true
34+
35+ # enable master process
36+ master = true
37+
38+ # load apps in each worker instead of the master
39+ lazy-apps = true
40+
41+ # load uWSGI plugins
42+ plugin = python3,http
43+
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
50+
51+ # plugin: python
52+ # --------------
53+ #
54+ # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python
55+
56+ # load a WSGI module
57+ module = searx.webapp
58+
59+ # set PYTHONHOME/virtualenv
60+ virtualenv = /usr/local/searx/searx-pyenv
61+
62+ # add directory (or glob) to pythonpath
63+ pythonpath = /usr/local/searx/searx-src
64+
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
81+
82+
docs/admin/installation.rst+38−209
@@ -4,234 +4,63 @@
44Installation
55============
66
7−.. sidebar:: Searx server setup
7+*You're spoilt for choice*, choose your preferred method of installation.
88
9− - :ref:`installation nginx`
10− - :ref:`installation apache`
9+- :ref:`installation docker`
10+- `Installation scripts`_
11+- :ref:`installation basic`
1112
12− If you do not have any special preferences, it is recommend to use
13− :ref:`searx.sh`.
13+The :ref:`installation basic` is good enough for intranet usage and it is a
14+excellent illustration of *how a searx instance is build up*. If you place your
15+instance public to the internet you should really consider to install a
16+:ref:`filtron reverse proxy <filtron.sh>` and for privacy a :ref:`result proxy
17+<morty.sh>` is mandatory.
1418
15−.. contents:: Contents
16− :depth: 2
17− :local:
18− :backlinks: entry
19+Therefore, if you do not have any special preferences, its recommend to use the
20+:ref:`installation docker` or the `Installation scripts`_ from our :ref:`tooling
21+box <toolboxing>` as described below.
1922
20−.. _installation basic:
2123
22−Basic installation
23−==================
24+Installation scripts
25+====================
2426
25−Step by step installation with virtualenv. For Ubuntu, be sure to have enable
26−universe repository.
27+The following will install a setup as shown in :ref:`architecture`. First you
28+need to get a clone. The clone is only needed for the installation procedure
29+and some maintenance tasks (alternatively you can create your own fork).
2730
28−Install packages:
31+.. code:: bash
2932
30−.. tabs::
33+ $ cd ~/Download
34+ $ git clone https://github.com/asciimoo/searx searx
35+ $ cd searx
3136
32− .. group-tab:: Ubuntu / debian
37+.. hint::
3338
34− .. code-block:: sh
39+ The *tooling box* is not yet merged into `asciimoo/searx master
40+ <https://github.com/asciimoo/searx>`_. As long as PR is not merged, you need
41+ to merge the PR into your local clone (see below). The discussion takes
42+ place in :pull:`1803`. To merge the :pull:`1803` in your local branch use:
3543
36− $ sudo -H apt-get install -m \
37− git build-essential
38− libxslt-dev python3-dev python3-babel python3-venv \
39− zlib1g-dev libffi-dev libssl-dev
44+ .. code:: bash
4045
41−Install searx:
46+ $ git pull origin refs/pull/1803/head
4247
43−.. code:: sh
48+**Install** :ref:`searx service <searx.sh>`
4449
45− sudo -H useradd searx --system --disabled-password -d /usr/local/searx
46− sudo -H usermod -a -G shadow searx
47− cd /usr/local/searx
48− sudo -H git clone https://github.com/asciimoo/searx.git searx-src
49− sudo -H chown searx:searx -R /usr/local/searx
50+This installs searx as described in :ref:`installation basic`.
5051
51−Install virtualenv:
52+.. code:: bash
5253
53−.. code:: sh
54+ $ sudo -H ./utils/searx.sh install all
5455
55− sudo -H -u searx -i
56− (searx)$ python3 -m venv searx-pyenv
57− (searx)$ echo 'source ~/searx-pyenv/bin/activate' > ~/.profile
56+**Install** :ref:`filtron reverse proxy <filtron.sh>`
5857
59−Exit the searx bash and restart a new to install the searx dependencies:
58+.. code:: bash
6059
61−.. code:: sh
60+ $ sudo -H ./utils/filtron.sh install all
6261
63− sudo -H -u searx -i
64− (searx)$ cd searx-src
65− (searx)$ ./manage.sh update_packages
62+**Install** :ref:`result proxy <morty.sh>`
6663
67−Configuration
68−==============
64+.. code:: bash
6965
70−.. code:: sh
71−
72− sudo -H -u searx -i
73− (searx)$ cd searx-src
74− (searx)$ sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
75−
76−Edit searx/settings.yml if necessary.
77−
78−Check
79−=====
80−
81−Start searx:
82−
83−.. code:: sh
84−
85− sudo -H -u searx -i
86− (searx)$ cd searx-src
87− (searx)$ python3 searx/webapp.py
88−
89−Go to http://localhost:8888
90−
91−If everything works fine, disable the debug option in settings.yml:
92−
93−.. code:: sh
94−
95− sed -i -e "s/debug : True/debug : False/g" searx/settings.yml
96−
97−At this point searx is not demonized ; uwsgi allows this. You can exit the
98−virtualenv and the searx user bash (enter exit command twice).
99−
100−uwsgi
101−=====
102−
103−Install packages:
104−
105−.. tabs::
106−
107− .. group-tab:: Ubuntu / debian
108−
109− .. code-block:: bash
110−
111− sudo -H apt-get install uwsgi uwsgi-plugin-python3
112−
113−Create the configuration file ``/etc/uwsgi/apps-available/searx.ini`` with this
114−content:
115−
116−.. code:: ini
117−
118− [uwsgi]
119−
120− # uWSGI core
121− # ----------
122− #
123− # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core
124−
125− # Who will run the code
126− uid = searx
127− gid = searx
128−
129− # chdir to specified directory before apps loading
130− chdir = /usr/local/searx/searx-src/searx
131−
132− # disable logging for privacy
133− disable-logging = true
134−
135− # The right granted on the created socket
136− chmod-socket = 666
137−
138− # Plugin to use and interpretor config
139− single-interpreter = true
140−
141− # enable master process
142− master = true
143−
144− # load apps in each worker instead of the master
145− lazy-apps = true
146−
147− # load uWSGI plugins
148− plugin = python3,http
149−
150− # By default the Python plugin does not initialize the GIL. This means your
151− # app-generated threads will not run. If you need threads, remember to enable
152− # them with enable-threads. Running uWSGI in multithreading mode (with the
153− # threads options) will automatically enable threading support. This *strange*
154− # default behaviour is for performance reasons.
155− enable-threads = true
156−
157− # plugin: python
158− # --------------
159− #
160− # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python
161−
162− # load a WSGI module
163− module = searx.webapp
164−
165− # set PYTHONHOME/virtualenv
166− virtualenv = /usr/local/searx/searx-pyenv
167−
168− # add directory (or glob) to pythonpath
169− pythonpath = /usr/local/searx/searx-src
170−
171−
172− # plugin http
173− # -----------
174− #
175− # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http
176−
177− # Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html
178− http = 127.0.0.1:8888
179−
180−Activate the uwsgi application and restart:
181−
182−.. code:: sh
183−
184− cd /etc/uwsgi/apps-enabled
185− ln -s ../apps-available/searx.ini
186− /etc/init.d/uwsgi restart
187−
188−
189−How to update
190−=============
191−
192−.. code:: sh
193−
194− sudo -H -u searx -i
195− (searx)$ git stash
196− (searx)$ git pull origin master
197− (searx)$ git stash apply
198− (searx)$ ./manage.sh update_packages
199−
200−Restart uwsgi:
201−
202−.. tabs::
203−
204− .. group-tab:: Ubuntu / debian
205−
206− .. code:: sh
207−
208− sudo -H systemctl restart uwsgi
209−
210−Docker
211−======
212−
213−Make sure you have installed Docker. For instance, you can deploy searx like this:
214−
215−.. code:: sh
216−
217− docker pull wonderfall/searx
218− docker run -d --name searx -p $PORT:8888 wonderfall/searx
219−
220−Go to ``http://localhost:$PORT``.
221−
222−See https://hub.docker.com/r/wonderfall/searx/ for more informations. It's also
223−possible to build searx from the embedded Dockerfile.
224−
225−.. code:: sh
226−
227− git clone https://github.com/asciimoo/searx.git
228− cd searx
229− docker build -t whatever/searx .
230−
231−References
232−==========
233−
234−* https://about.okhin.fr/posts/Searx/ with some additions
235−
236−* How to: `Setup searx in a couple of hours with a free SSL certificate
237− <https://www.reddit.com/r/privacytoolsIO/comments/366kvn/how_to_setup_your_own_privacy_respecting_search/>`__
66+ $ sudo -H ./utils/morty.sh install all
docs/admin/update-searx.rstnew file+23
@@ -0,0 +1,23 @@
1+.. _update searx:
2+
3+=============
4+How to update
5+=============
6+
7+.. code:: sh
8+
9+ sudo -H -u searx -i
10+ (searx)$ git stash
11+ (searx)$ git pull origin master
12+ (searx)$ git stash apply
13+ (searx)$ ./manage.sh update_packages
14+
15+Restart uwsgi:
16+
17+.. tabs::
18+
19+ .. group-tab:: Ubuntu / debian
20+
21+ .. code:: sh
22+
23+ sudo -H systemctl restart uwsgi
docs/utils/index.rst−9
@@ -1,4 +1,3 @@
1−
21.. _searx_utils:
32.. _toolboxing:
43
@@ -9,14 +8,6 @@ Tooling box ``utils/*``
98In the folder :origin:`utils/` we maintain some tools useful for admins and
109developers.
1110
12−.. sidebar:: Work needed!
13−
14− Our scripts to maintain services do most support only systemd init process
15− used by debian, ubuntu and many other dists. In general our scripts are only
16− partially usable on debian systems. We are working on this limitation, if
17− you have any contribution, please send us your :pull:`PR <../pulls>`, see
18− :ref:`how to contribute`.
19−
2011.. toctree::
2112 :maxdepth: 2
2213 :caption: Contents
utils/filtron.sh+4
@@ -180,6 +180,10 @@ main() {
180180 debug-off) echo; disable_debug ;;
181181 *) usage "$_usage"; exit 42;;
182182 esac ;;
183+ doc)
184+ echo
185+ echo ".. generic utils/filtron.sh documentation"
186+ ;;
183187
184188 *) usage "unknown or missing command $1"; exit 42;;
185189 esac
utils/lib.sh+6−2
@@ -933,7 +933,9 @@ pkg_install() {
933933 # usage: TITEL='install foobar' pkg_install foopkg barpkg
934934
935935 rst_title "${TITLE:-installation of packages}" section
936− echo -en "\npackage(s)::\n\n $*\n" | $FMT
936+ echo -e "\npackage(s)::\n"
937+ # shellcheck disable=SC2068
938+ echo " " $@ | $FMT
937939
938940 if ! ask_yn "Should packages be installed?" Yn 30; then
939941 return 42
@@ -959,7 +961,9 @@ pkg_remove() {
959961 # usage: TITEL='remove foobar' pkg_remove foopkg barpkg
960962
961963 rst_title "${TITLE:-remove packages}" section
962− echo -en "\npackage(s)::\n\n $*\n" | $FMT
964+ echo -e "\npackage(s)::\n"
965+ # shellcheck disable=SC2068
966+ echo " " $@ | $FMT
963967
964968 if ! ask_yn "Should packages be removed (purge)?" Yn 30; then
965969 return 42
utils/lxc.sh+5
@@ -209,6 +209,11 @@ main() {
209209 searx-suite) searx_suite_install ;;
210210 esac
211211 ;;
212+ doc)
213+ echo
214+ echo ".. generic utils/lxc.sh documentation"
215+ ;;
216+
212217 *)
213218 usage "unknown or missing command $1"; exit 42;;
214219 esac
utils/morty.sh+4
@@ -183,6 +183,10 @@ main() {
183183 debug-off) disable_debug ;;
184184 *) usage "$_usage"; exit 42;;
185185 esac ;;
186+ doc)
187+ echo
188+ echo ".. generic utils/morty.sh documentation"
189+ ;;
186190
187191 *) usage "ERROR: unknown or missing command $1"; exit 42;;
188192 esac
utils/searx.sh+195−19
@@ -36,25 +36,28 @@ SEARX_UWSGI_APP="searx.ini"
3636# shellcheck disable=SC2034
3737SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket"
3838
39+# apt packages
40+SEARX_PACKAGES_debian="\
41+python3-dev python3-babel python3-venv
42+uwsgi uwsgi-plugin-python3
43+git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev"
44+
45+# pacman packages
46+SEARX_PACKAGES_arch="\
47+python python-pip python-lxml python-babel
48+uwsgi uwsgi-plugin-python
49+git base-devel libxml2"
50+
51+# dnf packages
52+SEARX_PACKAGES_fedora="\
53+python python-pip python-lxml python-babel
54+uwsgi uwsgi-plugin-python3
55+git @development-tools libxml2"
56+
3957case $DIST_ID in
40− ubuntu|debian) # apt packages
41− SEARX_PACKAGES="\
42− python3-dev python3-babel python3-venv \
43− uwsgi uwsgi-plugin-python3 \
44− git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev "
45− ;;
46− arch) # pacman packages
47− SEARX_PACKAGES="\
48− python python-pip python-lxml python-babel \
49− uwsgi uwsgi-plugin-python \
50− git base-devel libxml2 "
51− ;;
52− fedora) # dnf packages
53− SEARX_PACKAGES="\
54− python python-pip python-lxml python-babel \
55− uwsgi uwsgi-plugin-python3 \
56− git @development-tools libxml2 "
57− ;;
58+ ubuntu|debian) SEARX_PACKAGES="${SEARX_PACKAGES_debian}" ;;
59+ arch) SEARX_PACKAGES="${SEARX_PACKAGES_arch}" ;;
60+ fedora) SEARX_PACKAGES="${SEARX_PACKAGES_fedora}" ;;
5861esac
5962
6063# Apache Settings
@@ -206,6 +209,7 @@ main() {
206209 remove) remove_apache_site ;;
207210 *) usage "$_usage"; exit 42;;
208211 esac ;;
212+ doc) rst-doc;;
209213
210214 *) usage "unknown or missing command $1"; exit 42;;
211215 esac
@@ -443,7 +447,7 @@ test_local_searx() {
443447 tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
444448export SEARX_SETTINGS_PATH="${SEARX_SETTINGS_PATH}"
445449cd ${SEARX_SRC}
446−timeout 10 python3 searx/webapp.py &
450+timeout 10 python searx/webapp.py &
447451sleep 3
448452curl --location --verbose --head --insecure $SEARX_INTERNAL_URL
449453EOF
@@ -631,6 +635,178 @@ This removes apache site ${APACHE_SEARX_SITE}."
631635 apache_remove_site "${APACHE_SEARX_SITE}"
632636}
633637
638+rst-doc() {
639+ local debian="${SEARX_PACKAGES_debian}"
640+ local arch="${SEARX_PACKAGES_arch}"
641+ local fedora="${SEARX_PACKAGES_fedora}"
642+ debian="$(echo "${debian}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
643+ arch="$(echo "${arch}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
644+ fedora="$(echo "${fedora}" | sed 's/.*/ & \\/' | sed '$ s/.$//')"
645+
646+ cat <<EOF
647+
648+.. START distro-packages
649+
650+.. tabs::
651+
652+ .. group-tab:: Ubuntu / debian
653+
654+ .. code-block:: sh
655+
656+ $ sudo -H apt-get install -y \\
657+${debian}
658+
659+ .. group-tab:: Arch Linux
660+
661+ .. code-block:: sh
662+
663+ $ sudo -H pacman -S --noconfirm \\
664+${arch}
665+
666+ .. group-tab:: Fedora / RHEL
667+
668+ .. code-block:: sh
669+
670+ $ sudo -H dnf install -y \\
671+${fedora}
672+
673+.. END distro-packages
674+
675+
676+.. START create user
677+
678+.. tabs::
679+
680+ .. group-tab:: bash
681+
682+ .. code-block:: sh
683+
684+ $ sudo -H useradd --shell /bin/bash --system \\
685+ --home-dir "$SERVICE_HOME" \\
686+ --comment "Privacy-respecting metasearch engine" $SERVICE_USER
687+
688+ $ sudo -H mkdir "$SERVICE_HOME"
689+ $ sudo -H chown -R "$SERVICE_GROUP:$SERVICE_GROUP" "$SERVICE_HOME"
690+
691+.. END create user
692+
693+.. START clone searx
694+
695+.. tabs::
696+
697+ .. group-tab:: bash
698+
699+ .. code-block:: sh
700+
701+ $ sudo -H -u ${SERVICE_USER} -i
702+ (${SERVICE_USER})$ git clone "https://github.com/asciimoo/searx.git" "$SEARX_SRC"
703+
704+.. END clone searx
705+
706+.. START create virtualenv
707+
708+.. tabs::
709+
710+ .. group-tab:: bash
711+
712+ .. code-block:: sh
713+
714+ (${SERVICE_USER})$ python3 -m venv "${SEARX_PYENV}"
715+ (${SERVICE_USER})$ echo ". ${SEARX_PYENV}/bin/activate" >> "$SERVICE_HOME/.profile"
716+
717+.. END create virtualenv
718+
719+.. START manage.sh update_packages
720+
721+.. tabs::
722+
723+ .. group-tab:: bash
724+
725+ .. code-block:: sh
726+
727+ $ sudo -H -u ${SERVICE_USER} -i
728+
729+ (${SERVICE_USER})$ command -v python && python --version
730+ $SEARX_PYENV/bin/python
731+ Python 3.8.1
732+
733+ (${SERVICE_USER})$ cd "$SEARX_SRC"
734+ (${SERVICE_USER})$ ./manage.sh update_packages
735+
736+.. END manage.sh update_packages
737+
738+.. START searx config
739+
740+.. tabs::
741+
742+ .. group-tab:: bash
743+
744+ .. code-block:: sh
745+
746+ $ sudo -H cp "$SEARX_SRC/searx/settings.yml" "${SEARX_SETTINGS_PATH}"
747+ $ sudo -H sed -i -e "s/ultrasecretkey/\$(openssl rand -hex 16)/g" "$SEARX_SETTINGS_PATH"
748+ $ sudo -H sed -i -e "s/{instance_name}/searx@\$(uname -n)/g" "$SEARX_SETTINGS_PATH"
749+
750+.. END searx config
751+
752+.. START check searx installation
753+
754+.. tabs::
755+
756+ .. group-tab:: bash
757+
758+ .. code-block:: sh
759+
760+ # enable debug ..
761+ $ sudo -H sed -i -e "s/debug : False/debug : True/g" "$SEARX_SETTINGS_PATH"
762+
763+ # start webapp
764+ $ sudo -H -u ${SERVICE_USER} -i
765+ (${SERVICE_USER})$ cd ${SEARX_SRC}
766+ (${SERVICE_USER})$ export SEARX_SETTINGS_PATH="${SEARX_SETTINGS_PATH}"
767+ (${SERVICE_USER})$ python searx/webapp.py
768+
769+ # disable debug
770+ $ sudo -H sed -i -e "s/debug : True/debug : False/g" "$SEARX_SETTINGS_PATH"
771+
772+Open WEB browser and visit http://$SEARX_INTERNAL_URL . If you are inside a
773+container or in a script, test with curl:
774+
775+.. tabs::
776+
777+ .. group-tab:: WEB browser
778+
779+ .. code-block:: sh
780+
781+ $ xgd-open http://$SEARX_INTERNAL_URL
782+
783+ .. group-tab:: curl
784+
785+ .. code-block:: none
786+
787+ $ curl --location --verbose --head --insecure $SEARX_INTERNAL_URL
788+
789+ * Trying 127.0.0.1:8888...
790+ * TCP_NODELAY set
791+ * Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)
792+ > HEAD / HTTP/1.1
793+ > Host: 127.0.0.1:8888
794+ > User-Agent: curl/7.68.0
795+ > Accept: */*
796+ >
797+ * Mark bundle as not supporting multiuse
798+ * HTTP 1.0, assume close after body
799+ < HTTP/1.0 200 OK
800+ HTTP/1.0 200 OK
801+ ...
802+
803+.. END check searx installation
804+
805+EOF
806+
807+}
808+
809+
634810# ----------------------------------------------------------------------------
635811main "$@"
636812# ----------------------------------------------------------------------------