gh-pages: updated

This commit is contained in:
Markus Heiser 2020-06-29 08:26:27 +02:00
parent e77ac05b76
commit 2fc3d5ed58
19 changed files with 1261 additions and 234 deletions

View File

@ -108,6 +108,7 @@ restart the uwsgi application.
:start-after: START searx uwsgi-description ubuntu-20.04
:end-before: END searx uwsgi-description ubuntu-20.04
.. hotfix: a bug group-tab need this comment
.. group-tab:: Arch Linux
@ -115,6 +116,7 @@ restart the uwsgi application.
:start-after: START searx uwsgi-description arch
:end-before: END searx uwsgi-description arch
.. hotfix: a bug group-tab need this comment
.. group-tab:: Fedora / RHEL
@ -128,22 +130,21 @@ restart the uwsgi application.
.. group-tab:: Ubuntu / debian
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
:code: ini
:start-after: START searx uwsgi-appini ubuntu-20.04
:end-before: END searx uwsgi-appini ubuntu-20.04
.. hotfix: a bug group-tab need this comment
.. group-tab:: Arch Linux
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
:code: ini
:start-after: START searx uwsgi-appini arch
:end-before: END searx uwsgi-appini arch
.. hotfix: a bug group-tab need this comment
.. group-tab:: Fedora / RHEL
.. kernel-include:: $DOCS_BUILD/includes/searx.rst
:code: ini
:start-after: START searx uwsgi-appini fedora
:end-before: END searx uwsgi-appini fedora

View File

@ -6,6 +6,7 @@ Blog
:maxdepth: 2
:caption: Contents
lxcdev-202006
python3
admin
intro-offline

View File

@ -0,0 +1,413 @@
.. _blog-lxcdev-202006:
=======================================
Developing in Linux containers [202006]
=======================================
.. _LXC: https://linuxcontainers.org/lxc/introduction/
.. sidebar:: Audience
This blog post is written for experienced admins and developers / readers
should have a serious meaning about: *distributed*, *merge* and *linux
container*.
.. contents:: Contents
:depth: 2
:local:
:backlinks: entry
In PR :PR:`1803` we added a lot of scripts to Searx's boilerplate. In this blog
post I will show you, how you can make use of them in *distributed and
heterogeneous development cycles* (TL;DR; jump to the :ref:`blog-lxcdev-202006
abstract`).
Motivation
==========
Normally in our development cycle, we edit the sources and run some test and/or
builds by using ``make`` before we commit. This cycle is simple and perfect but
might fail in some aspects we should not overlook.
The environment in which we run all our development processes matters!
The :ref:`makefile` and the :ref:`make pyenv` encapsulate a lot for us, but they
do not have access to all prerequisites. For example, there may have
dependencies on packages that are installed on the developer's desktop, but
usually are not preinstalled on a server or client system. Another examples
are; settings have been made to the software on the developer's host that would
never be set on a *production* system.
*Linux Containers* (LXC_) are isolate environments and not to mix up on
developer's all the prerequisites of all the projects he contribute to, is
always a good choice.
The scripts from PR :PR:`1803` can divide in those to install and maintain
software:
- :ref:`searx.sh`
- :ref:`filtron.sh`
- :ref:`morty.sh`
and the script :ref:`lxc.sh`, with we can scale our installation, maintenance or
even development tasks over a stack of containers, what we call: *Searx's lxc
suite*.
Gentlemen, start your engines!
==============================
.. _LXD: https://linuxcontainers.org/lxd/introduction/
.. _archlinux: https://www.archlinux.org/
Before you can start with containers, you need to install and initiate LXD_
once:
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ snap install lxd
$ lxd init --auto
And you need to clone from origin or if you have your own fork, clone from your
fork:
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ cd ~/Downloads
$ git clone https://github.com/asciimoo/searx.git
$ cd searx
The :ref:`lxc-searx.env` consists of several images, see ``export
LXC_SUITE=(...`` near by :origin:`utils/lxc-searx.env#L19`. For this blog post
we exercise on a archlinux_ image. The container of this image is named
``searx-archlinux``. Lets build the container, but be sure that this container
does not already exists, so first lets remove possible old one:
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh remove searx-archlinux
$ sudo -H ./utils/lxc.sh build searx-archlinux
.. sidebar:: The ``searx-archlinux`` container
is the base of all our exercises here.
In this container we install all services :ref:`including searx, morty & filtron
<lxc.sh install suite>` in once:
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh install suite searx-archlinux
To proxy HTTP from filtron and morty in the container to the outside of the
container, install nginx into the container. Once for the bot blocker filtron:
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
./utils/filtron.sh nginx install
...
INFO: got 429 from http://10.174.184.156/searx
and once for the content sanitizer (content proxy morty):
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
./utils/morty.sh nginx install
...
INFO: got 200 from http://10.174.184.156/morty/
.. sidebar:: Fully functional searx suite
From here on you have a fully functional searx suite running with bot blocker
(filtron) and Web content sanitizer (content proxy morty) needed for a
*privacy protecting* search engine.
On your system, the IP of your ``searx-archlinux`` container differs from
http://10.174.184.156/searx, just open the URL reported in your installation
protocol in your WEB browser from the desktop to test the instance from outside
of the container.
In such a searx suite admins can maintain and access the debug log of the
different services quite easy.
.. _working in containers:
In containers, work as usual
============================
Usually you open a root-bash using ``sudo -H bash``. In case of LXC containers
open the root-bash in the container using ``./utils/lxc.sh cmd
searx-archlinux``:
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux bash
INFO: [searx-archlinux] bash
[root@searx-archlinux searx]# pwd
/share/searx
The prompt ``[root@searx-archlinux ...]`` signals, that you are the root user in
the searx-container. To debug the running searx instance use:
.. tabs::
.. group-tab:: root@searx-archlinux
.. code:: sh
$ ./utils/searx.sh inspect service
...
use [CTRL-C] to stop monitoring the log
...
Back in the browser on your desktop open the service http://10.174.184.156/searx
and run your application tests while the debug log is shown in the terminal from
above. You can stop monitoring using ``CTRL-C``, this also disables the *"debug
option"* in searx's settings file and restarts the searx uwsgi application. To
debug services from filtron and morty analogous use:
.. tabs::
.. group-tab:: root@searx-archlinux
.. code:: sh
$ ./utils/filtron.sh inspect service
$ ./utils/morty.sh inspect service
Another point we have to notice is that each service (:ref:`searx <searx.sh>`,
:ref:`filtron <filtron.sh>` and :ref:`morty <morty.sh>`) runs under dedicated
system user account with the same name (compare :ref:`create searx user`). To
get a shell from theses accounts, simply call one of the scripts:
.. tabs::
.. group-tab:: root@searx-archlinux
.. code:: sh
$ ./utils/searx.sh shell
$ ./utils/filtron.sh shell
$ ./utils/morty.sh shell
To get in touch, open a shell from the service user (searx@searx-archlinux):
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
./utils/searx.sh shell
// exit with [CTRL-D]
(searx-pyenv) [searx@searx-archlinux ~]$ ...
The prompt ``[searx@searx-archlinux]`` signals that you are logged in as system
user ``searx`` in the ``searx-archlinux`` container and the python *virtualenv*
``(searx-pyenv)`` environment is activated.
.. tabs::
.. group-tab:: searx@searx-archlinux
.. code:: sh
(searx-pyenv) [searx@searx-archlinux ~]$ pwd
/usr/local/searx
Wrap production into developer suite
====================================
In this section we will see how to change the *"Fully functional searx suite"*
from a LXC container (which is quite ready for production) into a developer
suite. For this, we have to keep an eye on the :ref:`installation basic`:
- searx setup in: ``/etc/searx/settings.yml``
- searx user's home: ``/usr/local/searx``
- virtualenv in: ``/usr/local/searx/searx-pyenv``
- searx software in: ``/usr/local/searx/searx-src``
The searx software is a clone of the ``GIT_URL`` (see :ref:`makefile setup`) and
the working tree is checked out from the ``GIT_BRANCH``. With the use of the
:ref:`searx.sh` the searx service was installed as :ref:`uWSGI application
<searx uwsgi>`. To maintain this service, we can use ``systemctl`` (compare
:ref:`service architectures on distributions <uwsgi configuration>`).
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
systemctl stop uwsgi@searx
With the command above, we stopped the searx uWSGI-App in the archlinux
container.
The uWSGI-App for the archlinux dsitros is configured in
:origin:`utils/templates/etc/uwsgi/apps-archlinux/searx.ini`, from where at
least you should attend the settings of ``uid``, ``chdir``, ``env`` and
``http``::
env = SEARX_SETTINGS_PATH=/etc/searx/settings.yml
http = 127.0.0.1:8888
chdir = /usr/local/searx/searx-src/searx
virtualenv = /usr/local/searx/searx-pyenv
pythonpath = /usr/local/searx/searx-src
If you have read the :ref:`"Good to know section" <lxc.sh>` you remember, that
each container shares the root folder of the repository and the command
``utils/lxc.sh cmd`` handles relative path names **transparent**. To wrap the
searx installation into a developer one, we simple have to create a smylink to
the **transparent** reposetory from the desktop. Now lets replace the
repository at ``searx-src`` in the container with the working tree from outside
of the container:
.. tabs::
.. group-tab:: container becomes a developer suite
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
mv /usr/local/searx/searx-src /usr/local/searx/searx-src.old
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
ln -s /share/searx/ /usr/local/searx/searx-src
Now we can develop as usual in the working tree of our desktop system. Every
time the software was changed, you have to restart the searx service (in the
conatiner):
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
systemctl restart uwsgi@searx
Remember: :ref:`working in containers` .. here are just some examples from my
daily usage:
.. tabs::
.. group-tab:: desktop
To *inspect* the searx instance (already described above):
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
./utils/searx.sh inspect service
Run :ref:`makefile`, e.g. to test inside the container:
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
make test
To install all prerequisites needed for a :ref:`buildhosts`:
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
./utils/searx.sh install buildhost
To build the docs on a buildhost :ref:`buildhosts`:
.. code:: sh
$ sudo -H ./utils/lxc.sh cmd searx-archlinux \
make docs
.. _blog-lxcdev-202006 abstract:
Abstract
========
We build up a fully functional searx suite in a archlinux container:
.. code:: sh
$ sudo -H ./utils/lxc.sh install suite searx-archlinux
To access HTTP from the desktop we installed nginx for the services inside the
conatiner:
.. tabs::
.. group-tab:: [root@searx-archlinux]
.. code:: sh
$ ./utils/filtron.sh nginx install
$ ./utils/morty.sh nginx install
To wrap the suite into a developer one, we created a symbolic link to the
repository which is shared **transparent** from the desktop's file system into
the container :
.. tabs::
.. group-tab:: [root@searx-archlinux]
.. code:: sh
$ mv /usr/local/searx/searx-src /usr/local/searx/searx-src.old
$ ln -s /share/searx/ /usr/local/searx/searx-src
$ systemctl restart uwsgi@searx
To get remarks from the suite of the archlinux container we can use:
.. tabs::
.. group-tab:: desktop
.. code:: sh
$ sudo -H ./utils/lxc.sh show suite searx-archlinux
...
[searx-archlinux] INFO: (eth0) filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
[searx-archlinux] INFO: (eth0) morty: http://10.174.184.156:3000/
[searx-archlinux] INFO: (eth0) docs-live: http://10.174.184.156:8080/
[searx-archlinux] INFO: (eth0) IPv6: http://[fd42:573b:e0b3:e97e:216:3eff:fea5:9b65]
...

View File

@ -13,7 +13,7 @@ Private engines
To solve this issue private engines were introduced in :pull:`1823`.
A new option was added to engines named `tokens`. It expects a list
of strings. If the user making a request presents one of the tokens
of an engine, he/she is able to access information about the engine
of an engine, they can access information about the engine
and make search requests.
Example configuration to restrict access to the Arch Linux Wiki engine:

View File

@ -81,7 +81,7 @@ Parameters
Theme of instance.
Please note, available themes depend on an instance. It is possible that an
instance administrator deleted, created or renamed themes on his/her instance.
instance administrator deleted, created or renamed themes on their instance.
See the available options in the preferences page of the instance.
``oscar-style`` : default ``logicodev``
@ -91,7 +91,7 @@ Parameters
``oscar``.
Please note, available styles depend on an instance. It is possible that an
instance administrator deleted, created or renamed styles on his/her
instance administrator deleted, created or renamed styles on their
instance. See the available options in the preferences page of the instance.
``enabled_plugins`` : optional

View File

@ -44,9 +44,9 @@ hidden from visited result pages.
What are the consequences of using public instances?
----------------------------------------------------
If someone uses a public instance, he/she has to trust the administrator of that
If someone uses a public instance, they have to trust the administrator of that
instance. This means that the user of the public instance does not know whether
his/her requests are logged, aggregated and sent or sold to a third party.
their requests are logged, aggregated and sent or sold to a third party.
Also, public instances without proper protection are more vulnerable to abusing
the search service, In this case the external service in exchange returns

View File

@ -47,9 +47,9 @@ one**::
*Good to know ...*
Eeach container shares the root folder of the repository and the
command ``utils/lxc.sh cmd`` **handles relative path names transparent**,
compare output of::
Each container shares the root folder of the repository and the command
``utils/lxc.sh cmd`` **handles relative path names transparent**, compare output
of::
$ sudo -H ./utils/lxc.sh cmd -- ls -la Makefile
...
@ -66,6 +66,7 @@ If there comes the time you want to **get rid off all** the containers and
$ sudo -H ./utils/lxc.sh remove
$ sudo -H ./utils/lxc.sh remove images
.. _lxc.sh install suite:
Install suite
=============

View File

@ -224,7 +224,7 @@ a name of your choice <em>and/or</em> edit <code class="docutils literal not
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-YmFzaA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H cp /usr/local/searx/searx-src/searx/settings.yml /etc/searx/settings.yml
$ sudo -H sed -i -e s/ultrasecretkey/<span class="se">\1</span>0f5827a1c699bdc92caa3c0e921a6cd/g /etc/searx/settings.yml
$ sudo -H sed -i -e s/ultrasecretkey/<span class="se">\9</span>873266d1c899b68f21ca049ae5e5d93/g /etc/searx/settings.yml
$ sudo -H sed -i -e s/<span class="o">{</span>instance_name<span class="o">}</span>/searx@<span class="se">\r</span>yzen/g /etc/searx/settings.yml
</pre></div>
</div>

View File

@ -143,6 +143,11 @@ restart the uwsgi application.</p>
<p>Ubuntu / debian</p>
</div>
</div>
<div class="item sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="docutils container">
<p>Arch Linux</p>
</div>
</div>
<div class="item sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<div class="docutils container">
<p>Fedora / RHEL</p>
@ -150,38 +155,44 @@ restart the uwsgi application.</p>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu active docutils container">
<p># init.d &gt; /usr/share/doc/uwsgi/README.Debian.gz
# For uWSGI debian uses the LSB init process, this might be changed
# one day, see <a class="reference external" href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067</a></p>
<p>create /etc/uwsgi/apps-available/searx.ini
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># init.d --&gt; /usr/share/doc/uwsgi/README.Debian.gz</span>
<span class="c1"># For uWSGI debian uses the LSB init process, this might be changed</span>
<span class="c1"># one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067</span>
create /etc/uwsgi/apps-available/searx.ini
enable: sudo -H ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/
start: sudo -H service uwsgi start searx
restart: sudo -H service uwsgi restart searx
stop: sudo -H service uwsgi stop searx
disable: sudo -H rm /etc/uwsgi/apps-enabled/searx.ini
..</p>
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># systemd --&gt; /usr/lib/systemd/system/uwsgi@.service</span>
<span class="c1"># For uWSGI archlinux uses systemd template units, see</span>
<span class="c1"># - http://0pointer.de/blog/projects/instances.html</span>
<span class="c1"># - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd</span>
create: /etc/uwsgi/searx.ini
enable: sudo -H systemctl <span class="nb">enable</span> uwsgi@searx
start: sudo -H systemctl start uwsgi@searx
restart: sudo -H systemctl restart uwsgi@searx
stop: sudo -H systemctl stop uwsgi@searx
disable: sudo -H systemctl disable uwsgi@searx
</pre></div>
</div>
</div>
<blockquote>
<div><p># systemd &gt; /usr/lib/systemd/system/uwsgi&#64;.service
# For uWSGI archlinux uses systemd template units, see
# - <a class="reference external" href="http://0pointer.de/blog/projects/instances.html">http://0pointer.de/blog/projects/instances.html</a>
# - <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd">https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd</a></p>
<p>create: /etc/uwsgi/searx.ini
enable: sudo -H systemctl enable <a class="reference external" href="mailto:uwsgi&#37;&#52;&#48;searx">uwsgi<span>&#64;</span>searx</a>
start: sudo -H systemctl start <a class="reference external" href="mailto:uwsgi&#37;&#52;&#48;searx">uwsgi<span>&#64;</span>searx</a>
restart: sudo -H systemctl restart <a class="reference external" href="mailto:uwsgi&#37;&#52;&#48;searx">uwsgi<span>&#64;</span>searx</a>
stop: sudo -H systemctl stop <a class="reference external" href="mailto:uwsgi&#37;&#52;&#48;searx">uwsgi<span>&#64;</span>searx</a>
disable: sudo -H systemctl disable <a class="reference external" href="mailto:uwsgi&#37;&#52;&#48;searx">uwsgi<span>&#64;</span>searx</a>
..</p>
</div></blockquote>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<p># systemd &gt; /usr/lib/systemd/system/uwsgi.service
# The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see
# - <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html">https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html</a></p>
<p>create: /etc/uwsgi.d/searx.ini
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># systemd --&gt; /usr/lib/systemd/system/uwsgi.service</span>
<span class="c1"># The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see</span>
<span class="c1"># - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html</span>
create: /etc/uwsgi.d/searx.ini
restart: sudo -H touch /etc/uwsgi.d/searx.ini
disable: sudo -H rm /etc/uwsgi.d/searx.ini
..</p>
</pre></div>
</div>
</div>
</div>
<div class="sphinx-tabs docutils container">
@ -203,254 +214,254 @@ disable: sudo -H rm /etc/uwsgi.d/searx.ini
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu active docutils container">
<pre class="code ini literal-block"><code><span class="keyword">[uwsgi]</span>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>uwsgi<span class="o">]</span>
<span class="comment single"># uWSGI core</span>
<span class="comment single"># ----------</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
<span class="c1"># uWSGI core</span>
<span class="c1"># ----------</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
<span class="comment single"># Who will run the code</span>
<span class="name attribute">uid</span> <span class="operator">=</span> <span class="literal string">searx</span>
<span class="name attribute">gid</span> <span class="operator">=</span> <span class="literal string">searx</span>
<span class="c1"># Who will run the code</span>
<span class="nv">uid</span> <span class="o">=</span> searx
<span class="nv">gid</span> <span class="o">=</span> searx
<span class="comment single"># chdir to specified directory before apps loading</span>
<span class="name attribute">chdir</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-src/searx</span>
<span class="c1"># chdir to specified directory before apps loading</span>
<span class="nv">chdir</span> <span class="o">=</span> /usr/local/searx/searx-src/searx
<span class="comment single"># searx configuration (settings.yml)</span>
<span class="name attribute">env</span> <span class="operator">=</span> <span class="literal string">SEARX_SETTINGS_PATH=/etc/searx/settings.yml</span>
<span class="c1"># searx configuration (settings.yml)</span>
<span class="nv">env</span> <span class="o">=</span> <span class="nv">SEARX_SETTINGS_PATH</span><span class="o">=</span>/etc/searx/settings.yml
<span class="comment single"># disable logging for privacy</span>
<span class="name attribute">disable-logging</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># disable logging for privacy</span>
disable-logging <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># The right granted on the created socket</span>
<span class="name attribute">chmod-socket</span> <span class="operator">=</span> <span class="literal string">666</span>
<span class="c1"># The right granted on the created socket</span>
chmod-socket <span class="o">=</span> 666
<span class="comment single"># Plugin to use and interpretor config</span>
<span class="name attribute">single-interpreter</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># Plugin to use and interpretor config</span>
single-interpreter <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># enable master process</span>
<span class="name attribute">master</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># enable master process</span>
<span class="nv">master</span> <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># load apps in each worker instead of the master</span>
<span class="name attribute">lazy-apps</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># load apps in each worker instead of the master</span>
lazy-apps <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># load uWSGI plugins</span>
<span class="name attribute">plugin</span> <span class="operator">=</span> <span class="literal string">python3,http</span>
<span class="c1"># load uWSGI plugins</span>
<span class="nv">plugin</span> <span class="o">=</span> python3,http
<span class="comment single"># By default the Python plugin does not initialize the GIL. This means your</span>
<span class="comment single"># app-generated threads will not run. If you need threads, remember to enable</span>
<span class="comment single"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
<span class="comment single"># threads options) will automatically enable threading support. This *strange*</span>
<span class="comment single"># default behaviour is for performance reasons.</span>
<span class="name attribute">enable-threads</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># By default the Python plugin does not initialize the GIL. This means your</span>
<span class="c1"># app-generated threads will not run. If you need threads, remember to enable</span>
<span class="c1"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
<span class="c1"># threads options) will automatically enable threading support. This *strange*</span>
<span class="c1"># default behaviour is for performance reasons.</span>
enable-threads <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># plugin: python</span>
<span class="comment single"># --------------</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
<span class="c1"># plugin: python</span>
<span class="c1"># --------------</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
<span class="comment single"># load a WSGI module</span>
<span class="name attribute">module</span> <span class="operator">=</span> <span class="literal string">searx.webapp</span>
<span class="c1"># load a WSGI module</span>
<span class="nv">module</span> <span class="o">=</span> searx.webapp
<span class="comment single"># set PYTHONHOME/virtualenv</span>
<span class="name attribute">virtualenv</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-pyenv</span>
<span class="c1"># set PYTHONHOME/virtualenv</span>
<span class="nv">virtualenv</span> <span class="o">=</span> /usr/local/searx/searx-pyenv
<span class="comment single"># add directory (or glob) to pythonpath</span>
<span class="name attribute">pythonpath</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-src</span>
<span class="c1"># add directory (or glob) to pythonpath</span>
<span class="nv">pythonpath</span> <span class="o">=</span> /usr/local/searx/searx-src
<span class="comment single"># speak to upstream</span>
<span class="comment single"># -----------------</span>
<span class="comment single">#</span>
<span class="comment single"># Activate the 'http' configuration for filtron or activate the 'socket'</span>
<span class="comment single"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
<span class="c1"># speak to upstream</span>
<span class="c1"># -----------------</span>
<span class="c1">#</span>
<span class="c1"># Activate the &#39;http&#39; configuration for filtron or activate the &#39;socket&#39;</span>
<span class="c1"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
<span class="comment single"># using IP:</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
<span class="comment single"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
<span class="c1"># using IP:</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
<span class="c1"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
<span class="name attribute">http</span> <span class="operator">=</span> <span class="literal string">127.0.0.1:8888</span>
<span class="nv">http</span> <span class="o">=</span> 127.0.0.1:8888
<span class="comment single"># using unix-sockets:</span>
<span class="comment single">#</span>
<span class="comment single"># On some distributions you need to create the app folder for the sockets::</span>
<span class="comment single">#</span>
<span class="comment single"># mkdir -p /run/uwsgi/app/searx</span>
<span class="comment single"># chmod -R searx:searx /run/uwsgi/app/searx</span>
<span class="comment single">#</span>
<span class="comment single"># socket = /run/uwsgi/app/searx/socket</span>
<span class="error">..</span></code></pre>
<span class="c1"># using unix-sockets:</span>
<span class="c1">#</span>
<span class="c1"># On some distributions you need to create the app folder for the sockets::</span>
<span class="c1">#</span>
<span class="c1"># mkdir -p /run/uwsgi/app/searx</span>
<span class="c1"># chmod -R searx:searx /run/uwsgi/app/searx</span>
<span class="c1">#</span>
<span class="c1"># socket = /run/uwsgi/app/searx/socket</span>
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<pre class="code ini literal-block"><code><span class="keyword">[uwsgi]</span>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>uwsgi<span class="o">]</span>
<span class="comment single"># uWSGI core</span>
<span class="comment single"># ----------</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
<span class="c1"># uWSGI core</span>
<span class="c1"># ----------</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
<span class="comment single"># Who will run the code</span>
<span class="name attribute">uid</span> <span class="operator">=</span> <span class="literal string">searx</span>
<span class="name attribute">gid</span> <span class="operator">=</span> <span class="literal string">searx</span>
<span class="c1"># Who will run the code</span>
<span class="nv">uid</span> <span class="o">=</span> searx
<span class="nv">gid</span> <span class="o">=</span> searx
<span class="comment single"># chdir to specified directory before apps loading</span>
<span class="name attribute">chdir</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-src/searx</span>
<span class="c1"># chdir to specified directory before apps loading</span>
<span class="nv">chdir</span> <span class="o">=</span> /usr/local/searx/searx-src/searx
<span class="comment single"># searx configuration (settings.yml)</span>
<span class="name attribute">env</span> <span class="operator">=</span> <span class="literal string">SEARX_SETTINGS_PATH=/etc/searx/settings.yml</span>
<span class="c1"># searx configuration (settings.yml)</span>
<span class="nv">env</span> <span class="o">=</span> <span class="nv">SEARX_SETTINGS_PATH</span><span class="o">=</span>/etc/searx/settings.yml
<span class="comment single"># disable logging for privacy</span>
<span class="name attribute">logger</span> <span class="operator">=</span> <span class="literal string">systemd</span>
<span class="name attribute">disable-logging</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># disable logging for privacy</span>
<span class="nv">logger</span> <span class="o">=</span> systemd
disable-logging <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># The right granted on the created socket</span>
<span class="name attribute">chmod-socket</span> <span class="operator">=</span> <span class="literal string">666</span>
<span class="c1"># The right granted on the created socket</span>
chmod-socket <span class="o">=</span> 666
<span class="comment single"># Plugin to use and interpretor config</span>
<span class="name attribute">single-interpreter</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># Plugin to use and interpretor config</span>
single-interpreter <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># enable master process</span>
<span class="name attribute">master</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># enable master process</span>
<span class="nv">master</span> <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># load apps in each worker instead of the master</span>
<span class="name attribute">lazy-apps</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># load apps in each worker instead of the master</span>
lazy-apps <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># load uWSGI plugins</span>
<span class="name attribute">plugin</span> <span class="operator">=</span> <span class="literal string">python</span>
<span class="c1"># load uWSGI plugins</span>
<span class="nv">plugin</span> <span class="o">=</span> python
<span class="comment single"># By default the Python plugin does not initialize the GIL. This means your</span>
<span class="comment single"># app-generated threads will not run. If you need threads, remember to enable</span>
<span class="comment single"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
<span class="comment single"># threads options) will automatically enable threading support. This *strange*</span>
<span class="comment single"># default behaviour is for performance reasons.</span>
<span class="name attribute">enable-threads</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># By default the Python plugin does not initialize the GIL. This means your</span>
<span class="c1"># app-generated threads will not run. If you need threads, remember to enable</span>
<span class="c1"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
<span class="c1"># threads options) will automatically enable threading support. This *strange*</span>
<span class="c1"># default behaviour is for performance reasons.</span>
enable-threads <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># plugin: python</span>
<span class="comment single"># --------------</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
<span class="c1"># plugin: python</span>
<span class="c1"># --------------</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
<span class="comment single"># load a WSGI module</span>
<span class="name attribute">module</span> <span class="operator">=</span> <span class="literal string">searx.webapp</span>
<span class="c1"># load a WSGI module</span>
<span class="nv">module</span> <span class="o">=</span> searx.webapp
<span class="comment single"># set PYTHONHOME/virtualenv</span>
<span class="name attribute">virtualenv</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-pyenv</span>
<span class="c1"># set PYTHONHOME/virtualenv</span>
<span class="nv">virtualenv</span> <span class="o">=</span> /usr/local/searx/searx-pyenv
<span class="comment single"># add directory (or glob) to pythonpath</span>
<span class="name attribute">pythonpath</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-src</span>
<span class="c1"># add directory (or glob) to pythonpath</span>
<span class="nv">pythonpath</span> <span class="o">=</span> /usr/local/searx/searx-src
<span class="comment single"># speak to upstream</span>
<span class="comment single"># -----------------</span>
<span class="comment single">#</span>
<span class="comment single"># Activate the 'http' configuration for filtron or activate the 'socket'</span>
<span class="comment single"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
<span class="c1"># speak to upstream</span>
<span class="c1"># -----------------</span>
<span class="c1">#</span>
<span class="c1"># Activate the &#39;http&#39; configuration for filtron or activate the &#39;socket&#39;</span>
<span class="c1"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
<span class="comment single"># using IP:</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
<span class="comment single"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
<span class="c1"># using IP:</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
<span class="c1"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
<span class="name attribute">http</span> <span class="operator">=</span> <span class="literal string">127.0.0.1:8888</span>
<span class="nv">http</span> <span class="o">=</span> 127.0.0.1:8888
<span class="comment single"># using unix-sockets:</span>
<span class="comment single">#</span>
<span class="comment single"># On some distributions you need to create the app folder for the sockets::</span>
<span class="comment single">#</span>
<span class="comment single"># mkdir -p /run/uwsgi/app/searx</span>
<span class="comment single"># chown -R searx:searx /run/uwsgi/app/searx</span>
<span class="comment single">#</span>
<span class="comment single"># socket = /run/uwsgi/app/searx/socket</span>
<span class="error">..</span></code></pre>
<span class="c1"># using unix-sockets:</span>
<span class="c1">#</span>
<span class="c1"># On some distributions you need to create the app folder for the sockets::</span>
<span class="c1">#</span>
<span class="c1"># mkdir -p /run/uwsgi/app/searx</span>
<span class="c1"># chown -R searx:searx /run/uwsgi/app/searx</span>
<span class="c1">#</span>
<span class="c1"># socket = /run/uwsgi/app/searx/socket</span>
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<pre class="code ini literal-block"><code><span class="keyword">[uwsgi]</span>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>uwsgi<span class="o">]</span>
<span class="comment single"># uWSGI core</span>
<span class="comment single"># ----------</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
<span class="c1"># uWSGI core</span>
<span class="c1"># ----------</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
<span class="comment single"># Who will run the code</span>
<span class="name attribute">uid</span> <span class="operator">=</span> <span class="literal string">searx</span>
<span class="name attribute">gid</span> <span class="operator">=</span> <span class="literal string">searx</span>
<span class="c1"># Who will run the code</span>
<span class="nv">uid</span> <span class="o">=</span> searx
<span class="nv">gid</span> <span class="o">=</span> searx
<span class="comment single"># chdir to specified directory before apps loading</span>
<span class="name attribute">chdir</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-src/searx</span>
<span class="c1"># chdir to specified directory before apps loading</span>
<span class="nv">chdir</span> <span class="o">=</span> /usr/local/searx/searx-src/searx
<span class="comment single"># searx configuration (settings.yml)</span>
<span class="name attribute">env</span> <span class="operator">=</span> <span class="literal string">SEARX_SETTINGS_PATH=/etc/searx/settings.yml</span>
<span class="c1"># searx configuration (settings.yml)</span>
<span class="nv">env</span> <span class="o">=</span> <span class="nv">SEARX_SETTINGS_PATH</span><span class="o">=</span>/etc/searx/settings.yml
<span class="comment single"># disable logging for privacy</span>
<span class="name attribute">disable-logging</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># disable logging for privacy</span>
disable-logging <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># The right granted on the created socket</span>
<span class="name attribute">chmod-socket</span> <span class="operator">=</span> <span class="literal string">666</span>
<span class="c1"># The right granted on the created socket</span>
chmod-socket <span class="o">=</span> 666
<span class="comment single"># Plugin to use and interpretor config</span>
<span class="name attribute">single-interpreter</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># Plugin to use and interpretor config</span>
single-interpreter <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># enable master process</span>
<span class="name attribute">master</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># enable master process</span>
<span class="nv">master</span> <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># load apps in each worker instead of the master</span>
<span class="name attribute">lazy-apps</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># load apps in each worker instead of the master</span>
lazy-apps <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># load uWSGI plugins</span>
<span class="name attribute">plugin</span> <span class="operator">=</span> <span class="literal string">python3,http</span>
<span class="c1"># load uWSGI plugins</span>
<span class="nv">plugin</span> <span class="o">=</span> python3,http
<span class="comment single"># By default the Python plugin does not initialize the GIL. This means your</span>
<span class="comment single"># app-generated threads will not run. If you need threads, remember to enable</span>
<span class="comment single"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
<span class="comment single"># threads options) will automatically enable threading support. This *strange*</span>
<span class="comment single"># default behaviour is for performance reasons.</span>
<span class="name attribute">enable-threads</span> <span class="operator">=</span> <span class="literal string">true</span>
<span class="c1"># By default the Python plugin does not initialize the GIL. This means your</span>
<span class="c1"># app-generated threads will not run. If you need threads, remember to enable</span>
<span class="c1"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
<span class="c1"># threads options) will automatically enable threading support. This *strange*</span>
<span class="c1"># default behaviour is for performance reasons.</span>
enable-threads <span class="o">=</span> <span class="nb">true</span>
<span class="comment single"># plugin: python</span>
<span class="comment single"># --------------</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
<span class="c1"># plugin: python</span>
<span class="c1"># --------------</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
<span class="comment single"># load a WSGI module</span>
<span class="name attribute">module</span> <span class="operator">=</span> <span class="literal string">searx.webapp</span>
<span class="c1"># load a WSGI module</span>
<span class="nv">module</span> <span class="o">=</span> searx.webapp
<span class="comment single"># set PYTHONHOME/virtualenv</span>
<span class="name attribute">virtualenv</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-pyenv</span>
<span class="c1"># set PYTHONHOME/virtualenv</span>
<span class="nv">virtualenv</span> <span class="o">=</span> /usr/local/searx/searx-pyenv
<span class="comment single"># add directory (or glob) to pythonpath</span>
<span class="name attribute">pythonpath</span> <span class="operator">=</span> <span class="literal string">/usr/local/searx/searx-src</span>
<span class="c1"># add directory (or glob) to pythonpath</span>
<span class="nv">pythonpath</span> <span class="o">=</span> /usr/local/searx/searx-src
<span class="comment single"># speak to upstream</span>
<span class="comment single"># -----------------</span>
<span class="comment single">#</span>
<span class="comment single"># Activate the 'http' configuration for filtron or activate the 'socket'</span>
<span class="comment single"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
<span class="c1"># speak to upstream</span>
<span class="c1"># -----------------</span>
<span class="c1">#</span>
<span class="c1"># Activate the &#39;http&#39; configuration for filtron or activate the &#39;socket&#39;</span>
<span class="c1"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
<span class="comment single"># using IP:</span>
<span class="comment single">#</span>
<span class="comment single"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
<span class="comment single"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
<span class="c1"># using IP:</span>
<span class="c1">#</span>
<span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
<span class="c1"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
<span class="name attribute">http</span> <span class="operator">=</span> <span class="literal string">127.0.0.1:8888</span>
<span class="nv">http</span> <span class="o">=</span> 127.0.0.1:8888
<span class="comment single"># using unix-sockets:</span>
<span class="comment single">#</span>
<span class="comment single"># On some distributions you need to create the app folder for the sockets::</span>
<span class="comment single">#</span>
<span class="comment single"># mkdir -p /run/uwsgi/app/searx</span>
<span class="comment single"># chmod -R searx:searx /run/uwsgi/app/searx</span>
<span class="comment single">#</span>
<span class="comment single"># socket = /run/uwsgi/app/searx/socket</span>
<span class="error">..</span></code></pre>
<span class="c1"># using unix-sockets:</span>
<span class="c1">#</span>
<span class="c1"># On some distributions you need to create the app folder for the sockets::</span>
<span class="c1">#</span>
<span class="c1"># mkdir -p /run/uwsgi/app/searx</span>
<span class="c1"># chmod -R searx:searx /run/uwsgi/app/searx</span>
<span class="c1">#</span>
<span class="c1"># socket = /run/uwsgi/app/searx/socket</span>
</pre></div>
</div>
</div>
</div>
</div>

View File

@ -16,7 +16,7 @@
<script src="../_static/language_data.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Introducing Python 3 support" href="python3.html" />
<link rel="next" title="Developing in Linux containers [202006]" href="lxcdev-202006.html" />
<link rel="prev" title="utils/lxc.sh" href="../utils/lxc.sh.html" />
<script>DOCUMENTATION_OPTIONS.URL_ROOT = '../';</script>
@ -28,7 +28,7 @@
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="python3.html" title="Introducing Python 3 support"
<a href="lxcdev-202006.html" title="Developing in Linux containers [202006]"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../utils/lxc.sh.html" title="utils/lxc.sh"
@ -48,6 +48,14 @@
<div class="toctree-wrapper compound">
<p class="caption"><span class="caption-text">Contents</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="lxcdev-202006.html">Developing in Linux containers [202006]</a><ul>
<li class="toctree-l2"><a class="reference internal" href="lxcdev-202006.html#motivation">Motivation</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxcdev-202006.html#gentlemen-start-your-engines">Gentlemen, start your engines!</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxcdev-202006.html#in-containers-work-as-usual">In containers, work as usual</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxcdev-202006.html#wrap-production-into-developer-suite">Wrap production into developer suite</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxcdev-202006.html#abstract">Abstract</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="python3.html">Introducing Python 3 support</a><ul>
<li class="toctree-l2"><a class="reference internal" href="python3.html#how-to-run-searx-using-python-3">How to run searx using Python 3</a></li>
<li class="toctree-l2"><a class="reference internal" href="python3.html#fun-facts">Fun facts</a></li>
@ -105,7 +113,7 @@
<li><a href="../index.html">Overview</a>
<ul>
<li>Previous: <a href="../utils/lxc.sh.html" title="previous chapter"><code class="docutils literal notranslate"><span class="pre">utils/lxc.sh</span></code></a>
<li>Next: <a href="python3.html" title="next chapter">Introducing Python 3 support</a>
<li>Next: <a href="lxcdev-202006.html" title="next chapter">Developing in Linux containers [202006]</a>
</ul>
</li>
</ul>

591
blog/lxcdev-202006.html Normal file
View File

@ -0,0 +1,591 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Developing in Linux containers [202006] &#8212; Searx Documentation (Searx-0.16.0.tex)</title>
<link rel="stylesheet" href="../_static/searx.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_tabs/semantic-ui-2.4.1/segment.min.css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_tabs/semantic-ui-2.4.1/menu.min.css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_tabs/semantic-ui-2.4.1/tab.min.css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_tabs/tabs.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script src="../_static/sphinx_tabs/semantic-ui-2.4.1/tab.min.js"></script>
<script src="../_static/sphinx_tabs/tabs.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Introducing Python 3 support" href="python3.html" />
<link rel="prev" title="Blog" href="index.html" />
<script>DOCUMENTATION_OPTIONS.URL_ROOT = '../';</script>
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="python3.html" title="Introducing Python 3 support"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="Blog"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-0.16.0.tex)</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Blog</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Developing in Linux containers [202006]</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="developing-in-linux-containers-202006">
<span id="blog-lxcdev-202006"></span><h1>Developing in Linux containers [202006]<a class="headerlink" href="#developing-in-linux-containers-202006" title="Permalink to this headline"></a></h1>
<div class="sidebar">
<p class="sidebar-title">Audience</p>
<p>This blog post is written for experienced admins and developers / readers
should have a serious meaning about: <em>distributed</em>, <em>merge</em> and <em>linux
container</em>.</p>
</div>
<div class="contents local topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#motivation" id="id1">Motivation</a></p></li>
<li><p><a class="reference internal" href="#gentlemen-start-your-engines" id="id2">Gentlemen, start your engines!</a></p></li>
<li><p><a class="reference internal" href="#in-containers-work-as-usual" id="id3">In containers, work as usual</a></p></li>
<li><p><a class="reference internal" href="#wrap-production-into-developer-suite" id="id4">Wrap production into developer suite</a></p></li>
<li><p><a class="reference internal" href="#abstract" id="id5">Abstract</a></p></li>
</ul>
</div>
<p>In PR <a class="reference external" href="https://github.com/asciimoo/searx/pull/1803">#1803</a> we added a lot of scripts to Searxs boilerplate. In this blog
post I will show you, how you can make use of them in <em>distributed and
heterogeneous development cycles</em> (TL;DR; jump to the <a class="reference internal" href="#blog-lxcdev-202006-abstract"><span class="std std-ref">Abstract</span></a>).</p>
<div class="section" id="motivation">
<h2><a class="toc-backref" href="#id1">Motivation</a><a class="headerlink" href="#motivation" title="Permalink to this headline"></a></h2>
<p>Normally in our development cycle, we edit the sources and run some test and/or
builds by using <code class="docutils literal notranslate"><span class="pre">make</span></code> before we commit. This cycle is simple and perfect but
might fail in some aspects we should not overlook.</p>
<blockquote>
<div><p>The environment in which we run all our development processes matters!</p>
</div></blockquote>
<p>The <a class="reference internal" href="../dev/makefile.html#makefile"><span class="std std-ref">Makefile Targets</span></a> and the <a class="reference internal" href="../dev/makefile.html#make-pyenv"><span class="std std-ref">Python environment</span></a> encapsulate a lot for us, but they
do not have access to all prerequisites. For example, there may have
dependencies on packages that are installed on the developers desktop, but
usually are not preinstalled on a server or client system. Another examples
are; settings have been made to the software on the developers host that would
never be set on a <em>production</em> system.</p>
<p><em>Linux Containers</em> (<a class="reference external" href="https://linuxcontainers.org/lxc/introduction/">LXC</a>) are isolate environments and not to mix up on
developers all the prerequisites of all the projects he contribute to, is
always a good choice.</p>
<p>The scripts from PR <a class="reference external" href="https://github.com/asciimoo/searx/pull/1803">#1803</a> can divide in those to install and maintain
software:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../utils/searx.sh.html#searx-sh"><span class="std std-ref">utils/searx.sh</span></a></p></li>
<li><p><a class="reference internal" href="../utils/filtron.sh.html#filtron-sh"><span class="std std-ref">utils/filtron.sh</span></a></p></li>
<li><p><a class="reference internal" href="../utils/morty.sh.html#morty-sh"><span class="std std-ref">utils/morty.sh</span></a></p></li>
</ul>
<p>and the script <a class="reference internal" href="../utils/lxc.sh.html#lxc-sh"><span class="std std-ref">utils/lxc.sh</span></a>, with we can scale our installation, maintenance or
even development tasks over a stack of containers, what we call: <em>Searxs lxc
suite</em>.</p>
</div>
<div class="section" id="gentlemen-start-your-engines">
<h2><a class="toc-backref" href="#id2">Gentlemen, start your engines!</a><a class="headerlink" href="#gentlemen-start-your-engines" title="Permalink to this headline"></a></h2>
<p>Before you can start with containers, you need to install and initiate <a class="reference external" href="https://linuxcontainers.org/lxd/introduction/">LXD</a>
once:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ snap install lxd
$ lxd init --auto
</pre></div>
</div>
</div>
</div>
<p>And you need to clone from origin or if you have your own fork, clone from your
fork:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> ~/Downloads
$ git clone https://github.com/asciimoo/searx.git
$ <span class="nb">cd</span> searx
</pre></div>
</div>
</div>
</div>
<p>The <a class="reference internal" href="../utils/lxc.sh.html#lxc-searx-env"><span class="std std-ref">searx suite</span></a> consists of several images, see <code class="docutils literal notranslate"><span class="pre">export</span>
<span class="pre">LXC_SUITE=(...</span></code> near by <a class="reference external" href="https://github.com/asciimoo/searx/blob/master/utils/lxc-searx.env#L19">git://utils/lxc-searx.env#L19</a>. For this blog post
we exercise on a <a class="reference external" href="https://www.archlinux.org/">archlinux</a> image. The container of this image is named
<code class="docutils literal notranslate"><span class="pre">searx-archlinux</span></code>. Lets build the container, but be sure that this container
does not already exists, so first lets remove possible old one:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh remove searx-archlinux
$ sudo -H ./utils/lxc.sh build searx-archlinux
</pre></div>
</div>
</div>
</div>
<div class="sidebar">
<p class="sidebar-title">The <code class="docutils literal notranslate"><span class="pre">searx-archlinux</span></code> container</p>
<p>is the base of all our exercises here.</p>
</div>
<p>In this container we install all services <a class="reference internal" href="../utils/lxc.sh.html#lxc-sh-install-suite"><span class="std std-ref">including searx, morty &amp; filtron</span></a> in once:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh install suite searx-archlinux
</pre></div>
</div>
</div>
</div>
<p>To proxy HTTP from filtron and morty in the container to the outside of the
container, install nginx into the container. Once for the bot blocker filtron:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
./utils/filtron.sh nginx install
...
INFO: got <span class="m">429</span> from http://10.174.184.156/searx
</pre></div>
</div>
</div>
</div>
<p>and once for the content sanitizer (content proxy morty):</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
./utils/morty.sh nginx install
...
INFO: got <span class="m">200</span> from http://10.174.184.156/morty/
</pre></div>
</div>
</div>
</div>
<div class="sidebar">
<p class="sidebar-title">Fully functional searx suite</p>
<p>From here on you have a fully functional searx suite running with bot blocker
(filtron) and Web content sanitizer (content proxy morty) needed for a
<em>privacy protecting</em> search engine.</p>
</div>
<p>On your system, the IP of your <code class="docutils literal notranslate"><span class="pre">searx-archlinux</span></code> container differs from
<a class="reference external" href="http://10.174.184.156/searx">http://10.174.184.156/searx</a>, just open the URL reported in your installation
protocol in your WEB browser from the desktop to test the instance from outside
of the container.</p>
<p>In such a searx suite admins can maintain and access the debug log of the
different services quite easy.</p>
</div>
<div class="section" id="in-containers-work-as-usual">
<span id="working-in-containers"></span><h2><a class="toc-backref" href="#id3">In containers, work as usual</a><a class="headerlink" href="#in-containers-work-as-usual" title="Permalink to this headline"></a></h2>
<p>Usually you open a root-bash using <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">-H</span> <span class="pre">bash</span></code>. In case of LXC containers
open the root-bash in the container using <code class="docutils literal notranslate"><span class="pre">./utils/lxc.sh</span> <span class="pre">cmd</span>
<span class="pre">searx-archlinux</span></code>:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux bash
INFO: <span class="o">[</span>searx-archlinux<span class="o">]</span> bash
<span class="o">[</span>root@searx-archlinux searx<span class="o">]</span><span class="c1"># pwd</span>
/share/searx
</pre></div>
</div>
</div>
</div>
<p>The prompt <code class="docutils literal notranslate"><span class="pre">[root&#64;searx-archlinux</span> <span class="pre">...]</span></code> signals, that you are the root user in
the searx-container. To debug the running searx instance use:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-cm9vdEBzZWFyeC1hcmNobGludXg= docutils container">
<div class="docutils container">
<p><a class="reference external" href="mailto:root&#37;&#52;&#48;searx-archlinux">root<span>&#64;</span>searx-archlinux</a></p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-cm9vdEBzZWFyeC1hcmNobGludXg= active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ ./utils/searx.sh inspect service
...
use <span class="o">[</span>CTRL-C<span class="o">]</span> to stop monitoring the log
...
</pre></div>
</div>
</div>
</div>
<p>Back in the browser on your desktop open the service <a class="reference external" href="http://10.174.184.156/searx">http://10.174.184.156/searx</a>
and run your application tests while the debug log is shown in the terminal from
above. You can stop monitoring using <code class="docutils literal notranslate"><span class="pre">CTRL-C</span></code>, this also disables the <em>“debug
option”</em> in searxs settings file and restarts the searx uwsgi application. To
debug services from filtron and morty analogous use:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-cm9vdEBzZWFyeC1hcmNobGludXg= docutils container">
<div class="docutils container">
<p><a class="reference external" href="mailto:root&#37;&#52;&#48;searx-archlinux">root<span>&#64;</span>searx-archlinux</a></p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-cm9vdEBzZWFyeC1hcmNobGludXg= active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ ./utils/filtron.sh inspect service
$ ./utils/morty.sh inspect service
</pre></div>
</div>
</div>
</div>
<p>Another point we have to notice is that each service (<a class="reference internal" href="../utils/searx.sh.html#searx-sh"><span class="std std-ref">searx</span></a>,
<a class="reference internal" href="../utils/filtron.sh.html#filtron-sh"><span class="std std-ref">filtron</span></a> and <a class="reference internal" href="../utils/morty.sh.html#morty-sh"><span class="std std-ref">morty</span></a>) runs under dedicated
system user account with the same name (compare <a class="reference internal" href="../admin/installation-searx.html#create-searx-user"><span class="std std-ref">Create user</span></a>). To
get a shell from theses accounts, simply call one of the scripts:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-cm9vdEBzZWFyeC1hcmNobGludXg= docutils container">
<div class="docutils container">
<p><a class="reference external" href="mailto:root&#37;&#52;&#48;searx-archlinux">root<span>&#64;</span>searx-archlinux</a></p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-cm9vdEBzZWFyeC1hcmNobGludXg= active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ ./utils/searx.sh shell
$ ./utils/filtron.sh shell
$ ./utils/morty.sh shell
</pre></div>
</div>
</div>
</div>
<p>To get in touch, open a shell from the service user (<a class="reference external" href="mailto:searx&#37;&#52;&#48;searx-archlinux">searx<span>&#64;</span>searx-archlinux</a>):</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
./utils/searx.sh shell
// <span class="nb">exit</span> with <span class="o">[</span>CTRL-D<span class="o">]</span>
<span class="o">(</span>searx-pyenv<span class="o">)</span> <span class="o">[</span>searx@searx-archlinux ~<span class="o">]</span>$ ...
</pre></div>
</div>
</div>
</div>
<p>The prompt <code class="docutils literal notranslate"><span class="pre">[searx&#64;searx-archlinux]</span></code> signals that you are logged in as system
user <code class="docutils literal notranslate"><span class="pre">searx</span></code> in the <code class="docutils literal notranslate"><span class="pre">searx-archlinux</span></code> container and the python <em>virtualenv</em>
<code class="docutils literal notranslate"><span class="pre">(searx-pyenv)</span></code> environment is activated.</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-c2VhcnhAc2VhcngtYXJjaGxpbnV4 docutils container">
<div class="docutils container">
<p><a class="reference external" href="mailto:searx&#37;&#52;&#48;searx-archlinux">searx<span>&#64;</span>searx-archlinux</a></p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-c2VhcnhAc2VhcngtYXJjaGxpbnV4 active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="o">(</span>searx-pyenv<span class="o">)</span> <span class="o">[</span>searx@searx-archlinux ~<span class="o">]</span>$ <span class="nb">pwd</span>
/usr/local/searx
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="wrap-production-into-developer-suite">
<h2><a class="toc-backref" href="#id4">Wrap production into developer suite</a><a class="headerlink" href="#wrap-production-into-developer-suite" title="Permalink to this headline"></a></h2>
<p>In this section we will see how to change the <em>“Fully functional searx suite”</em>
from a LXC container (which is quite ready for production) into a developer
suite. For this, we have to keep an eye on the <a class="reference internal" href="../admin/installation-searx.html#installation-basic"><span class="std std-ref">Step by step installation</span></a>:</p>
<ul class="simple">
<li><p>searx setup in: <code class="docutils literal notranslate"><span class="pre">/etc/searx/settings.yml</span></code></p></li>
<li><p>searx users home: <code class="docutils literal notranslate"><span class="pre">/usr/local/searx</span></code></p></li>
<li><p>virtualenv in: <code class="docutils literal notranslate"><span class="pre">/usr/local/searx/searx-pyenv</span></code></p></li>
<li><p>searx software in: <code class="docutils literal notranslate"><span class="pre">/usr/local/searx/searx-src</span></code></p></li>
</ul>
<p>The searx software is a clone of the <code class="docutils literal notranslate"><span class="pre">GIT_URL</span></code> (see <a class="reference internal" href="../dev/makefile.html#makefile-setup"><span class="std std-ref">Makefile setup</span></a>) and
the working tree is checked out from the <code class="docutils literal notranslate"><span class="pre">GIT_BRANCH</span></code>. With the use of the
<a class="reference internal" href="../utils/searx.sh.html#searx-sh"><span class="std std-ref">utils/searx.sh</span></a> the searx service was installed as <a class="reference internal" href="../admin/installation-uwsgi.html#searx-uwsgi"><span class="std std-ref">uWSGI application</span></a>. To maintain this service, we can use <code class="docutils literal notranslate"><span class="pre">systemctl</span></code> (compare
<a class="reference internal" href="../admin/installation-uwsgi.html#uwsgi-configuration"><span class="std std-ref">service architectures on distributions</span></a>).</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
systemctl stop uwsgi@searx
</pre></div>
</div>
</div>
</div>
<p>With the command above, we stopped the searx uWSGI-App in the archlinux
container.</p>
<p>The uWSGI-App for the archlinux dsitros is configured in
<a class="reference external" href="https://github.com/asciimoo/searx/blob/master/utils/templates/etc/uwsgi/apps-archlinux/searx.ini">git://utils/templates/etc/uwsgi/apps-archlinux/searx.ini</a>, from where at
least you should attend the settings of <code class="docutils literal notranslate"><span class="pre">uid</span></code>, <code class="docutils literal notranslate"><span class="pre">chdir</span></code>, <code class="docutils literal notranslate"><span class="pre">env</span></code> and
<code class="docutils literal notranslate"><span class="pre">http</span></code>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>env = SEARX_SETTINGS_PATH=/etc/searx/settings.yml
http = 127.0.0.1:8888
chdir = /usr/local/searx/searx-src/searx
virtualenv = /usr/local/searx/searx-pyenv
pythonpath = /usr/local/searx/searx-src
</pre></div>
</div>
<p>If you have read the <a class="reference internal" href="../utils/lxc.sh.html#lxc-sh"><span class="std std-ref">“Good to know section”</span></a> you remember, that
each container shares the root folder of the repository and the command
<code class="docutils literal notranslate"><span class="pre">utils/lxc.sh</span> <span class="pre">cmd</span></code> handles relative path names <strong>transparent</strong>. To wrap the
searx installation into a developer one, we simple have to create a smylink to
the <strong>transparent</strong> reposetory from the desktop. Now lets replace the
repository at <code class="docutils literal notranslate"><span class="pre">searx-src</span></code> in the container with the working tree from outside
of the container:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-Y29udGFpbmVyIGJlY29tZXMgYSBkZXZlbG9wZXIgc3VpdGU= docutils container">
<div class="docutils container">
<p>container becomes a developer suite</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-Y29udGFpbmVyIGJlY29tZXMgYSBkZXZlbG9wZXIgc3VpdGU= active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
mv /usr/local/searx/searx-src /usr/local/searx/searx-src.old
$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
ln -s /share/searx/ /usr/local/searx/searx-src
</pre></div>
</div>
</div>
</div>
<p>Now we can develop as usual in the working tree of our desktop system. Every
time the software was changed, you have to restart the searx service (in the
conatiner):</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
systemctl restart uwsgi@searx
</pre></div>
</div>
</div>
</div>
<p>Remember: <a class="reference internal" href="#working-in-containers"><span class="std std-ref">In containers, work as usual</span></a> .. here are just some examples from my
daily usage:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<p>To <em>inspect</em> the searx instance (already described above):</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
./utils/searx.sh inspect service
</pre></div>
</div>
<p>Run <a class="reference internal" href="../dev/makefile.html#makefile"><span class="std std-ref">Makefile Targets</span></a>, e.g. to test inside the container:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
make <span class="nb">test</span>
</pre></div>
</div>
<p>To install all prerequisites needed for a <a class="reference internal" href="../admin/buildhosts.html#buildhosts"><span class="std std-ref">Buildhosts</span></a>:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
./utils/searx.sh install buildhost
</pre></div>
</div>
<p>To build the docs on a buildhost <a class="reference internal" href="../admin/buildhosts.html#buildhosts"><span class="std std-ref">Buildhosts</span></a>:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd searx-archlinux <span class="se">\</span>
make docs
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="abstract">
<span id="blog-lxcdev-202006-abstract"></span><h2><a class="toc-backref" href="#id5">Abstract</a><a class="headerlink" href="#abstract" title="Permalink to this headline"></a></h2>
<p>We build up a fully functional searx suite in a archlinux container:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh install suite searx-archlinux
</pre></div>
</div>
<p>To access HTTP from the desktop we installed nginx for the services inside the
conatiner:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-W3Jvb3RAc2VhcngtYXJjaGxpbnV4XQ== docutils container">
<div class="docutils container">
<p>[<a class="reference external" href="mailto:root&#37;&#52;&#48;searx-archlinux">root<span>&#64;</span>searx-archlinux</a>]</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-W3Jvb3RAc2VhcngtYXJjaGxpbnV4XQ== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ ./utils/filtron.sh nginx install
$ ./utils/morty.sh nginx install
</pre></div>
</div>
</div>
</div>
<p>To wrap the suite into a developer one, we created a symbolic link to the
repository which is shared <strong>transparent</strong> from the desktops file system into
the container :</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-W3Jvb3RAc2VhcngtYXJjaGxpbnV4XQ== docutils container">
<div class="docutils container">
<p>[<a class="reference external" href="mailto:root&#37;&#52;&#48;searx-archlinux">root<span>&#64;</span>searx-archlinux</a>]</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-W3Jvb3RAc2VhcngtYXJjaGxpbnV4XQ== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ mv /usr/local/searx/searx-src /usr/local/searx/searx-src.old
$ ln -s /share/searx/ /usr/local/searx/searx-src
$ systemctl restart uwsgi@searx
</pre></div>
</div>
</div>
</div>
<p>To get remarks from the suite of the archlinux container we can use:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-ZGVza3RvcA== docutils container">
<div class="docutils container">
<p>desktop</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-ZGVza3RvcA== active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh show suite searx-archlinux
...
<span class="o">[</span>searx-archlinux<span class="o">]</span> INFO: <span class="o">(</span>eth0<span class="o">)</span> filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
<span class="o">[</span>searx-archlinux<span class="o">]</span> INFO: <span class="o">(</span>eth0<span class="o">)</span> morty: http://10.174.184.156:3000/
<span class="o">[</span>searx-archlinux<span class="o">]</span> INFO: <span class="o">(</span>eth0<span class="o">)</span> docs-live: http://10.174.184.156:8080/
<span class="o">[</span>searx-archlinux<span class="o">]</span> INFO: <span class="o">(</span>eth0<span class="o">)</span> IPv6: http://<span class="o">[</span>fd42:573b:e0b3:e97e:216:3eff:fea5:9b65<span class="o">]</span>
...
</pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<span id="sidebar-top"></span>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
</a></p>
<h3>Project Links</h3>
<ul>
<li><a href="https://github.com/asciimoo/searx">Source</a>
<li><a href="https://github.com/asciimoo/searx/wiki">Wiki</a>
<li><a href="https://searx.space/">Public instances</a>
<li><a href="https://twitter.com/Searx_engine">Twitter</a>
</ul><h3>Navigation</h3>
<ul>
<li><a href="../index.html">Overview</a>
<ul>
<li><a href="index.html">Blog</a>
<ul>
<li>Previous: <a href="index.html" title="previous chapter">Blog</a>
<li>Next: <a href="python3.html" title="next chapter">Introducing Python 3 support</a></ul>
</li>
</ul>
</li>
</ul>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2015-2020, Adam Tauber, Noémi Ványi.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.1.1.
</div>
<script src="../_static/version_warning_offset.js"></script>
</body>
</html>

View File

@ -51,7 +51,7 @@ would rather share engines only with their trusted friends or colleagues.</p>
<p>To solve this issue private engines were introduced in <a class="reference external" href="https://github.com/asciimoo/searx/pull/1823">PR 1823</a>.
A new option was added to engines named <cite>tokens</cite>. It expects a list
of strings. If the user making a request presents one of the tokens
of an engine, he/she is able to access information about the engine
of an engine, they can access information about the engine
and make search requests.</p>
<p>Example configuration to restrict access to the Arch Linux Wiki engine:</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">name</span> <span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">arch linux wiki</span>

View File

@ -17,7 +17,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Searx admin interface" href="admin.html" />
<link rel="prev" title="Blog" href="index.html" />
<link rel="prev" title="Developing in Linux containers [202006]" href="lxcdev-202006.html" />
<script>DOCUMENTATION_OPTIONS.URL_ROOT = '../';</script>
</head><body>
@ -31,7 +31,7 @@
<a href="admin.html" title="Searx admin interface"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="Blog"
<a href="lxcdev-202006.html" title="Developing in Linux containers [202006]"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-0.16.0.tex)</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Blog</a> &#187;</li>
@ -124,7 +124,7 @@ version in your issue, so we can investigate it properly.</p>
<ul>
<li><a href="index.html">Blog</a>
<ul>
<li>Previous: <a href="index.html" title="previous chapter">Blog</a>
<li>Previous: <a href="lxcdev-202006.html" title="previous chapter">Developing in Linux containers [202006]</a>
<li>Next: <a href="admin.html" title="next chapter">Searx admin interface</a></ul>
</li>
</ul>

View File

@ -99,14 +99,14 @@ supports safe search in the preferences page of an instance.</p>
<dt><code class="docutils literal notranslate"><span class="pre">theme</span></code><span class="classifier">default <code class="docutils literal notranslate"><span class="pre">oscar</span></code></span></dt><dd><p>[ <code class="docutils literal notranslate"><span class="pre">oscar</span></code>, <code class="docutils literal notranslate"><span class="pre">simple</span></code>, <code class="docutils literal notranslate"><span class="pre">legacy</span></code>, <code class="docutils literal notranslate"><span class="pre">pix-art</span></code>, <code class="docutils literal notranslate"><span class="pre">courgette</span></code> ]</p>
<p>Theme of instance.</p>
<p>Please note, available themes depend on an instance. It is possible that an
instance administrator deleted, created or renamed themes on his/her instance.
instance administrator deleted, created or renamed themes on their instance.
See the available options in the preferences page of the instance.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">oscar-style</span></code><span class="classifier">default <code class="docutils literal notranslate"><span class="pre">logicodev</span></code></span></dt><dd><p>[ <code class="docutils literal notranslate"><span class="pre">pointhi</span></code>, <code class="docutils literal notranslate"><span class="pre">logicodev</span></code> ]</p>
<p>Style of Oscar theme. It is only parsed if the theme of an instance is
<code class="docutils literal notranslate"><span class="pre">oscar</span></code>.</p>
<p>Please note, available styles depend on an instance. It is possible that an
instance administrator deleted, created or renamed styles on his/her
instance administrator deleted, created or renamed styles on their
instance. See the available options in the preferences page of the instance.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">enabled_plugins</span></code><span class="classifier">optional</span></dt><dd><p>List of enabled plugins.</p>

View File

@ -110,6 +110,7 @@ digital rights</p></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="blog/index.html">Blog</a><ul>
<li class="toctree-l2"><a class="reference internal" href="blog/lxcdev-202006.html">Developing in Linux containers [202006]</a></li>
<li class="toctree-l2"><a class="reference internal" href="blog/python3.html">Introducing Python 3 support</a></li>
<li class="toctree-l2"><a class="reference internal" href="blog/admin.html">Searx admin interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="blog/intro-offline.html">Preparation for offline engines</a></li>

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -82,9 +82,9 @@ protecting users from search services, both referring page and search query are
hidden from visited result pages.</p>
<div class="section" id="what-are-the-consequences-of-using-public-instances">
<h3>What are the consequences of using public instances?<a class="headerlink" href="#what-are-the-consequences-of-using-public-instances" title="Permalink to this headline"></a></h3>
<p>If someone uses a public instance, he/she has to trust the administrator of that
<p>If someone uses a public instance, they have to trust the administrator of that
instance. This means that the user of the public instance does not know whether
his/her requests are logged, aggregated and sent or sold to a third party.</p>
their requests are logged, aggregated and sent or sold to a third party.</p>
<p>Also, public instances without proper protection are more vulnerable to abusing
the search service, In this case the external service in exchange returns
CAPTCHAs or bans the IP of the instance. Thus, search requests return less

View File

@ -78,9 +78,9 @@ one</strong>:</p>
</pre></div>
</div>
<p><em>Good to know …</em></p>
<p>Eeach container shares the root folder of the repository and the
command <code class="docutils literal notranslate"><span class="pre">utils/lxc.sh</span> <span class="pre">cmd</span></code> <strong>handles relative path names transparent</strong>,
compare output of:</p>
<p>Each container shares the root folder of the repository and the command
<code class="docutils literal notranslate"><span class="pre">utils/lxc.sh</span> <span class="pre">cmd</span></code> <strong>handles relative path names transparent</strong>, compare output
of:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh cmd -- ls -la Makefile
...
</pre></div>
@ -98,7 +98,7 @@ $ sudo -H ./utils/lxc.sh remove images
</pre></div>
</div>
<div class="section" id="install-suite">
<h2>Install suite<a class="headerlink" href="#install-suite" title="Permalink to this headline"></a></h2>
<span id="lxc-sh-install-suite"></span><h2>Install suite<a class="headerlink" href="#install-suite" title="Permalink to this headline"></a></h2>
<p>To install the complete <a class="reference internal" href="#lxc-searx-env"><span class="std std-ref">searx suite (includes searx, morty &amp; filtron)</span></a> into all <a class="reference external" href="https://linuxcontainers.org/lxc/introduction/">LXC</a> use:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/lxc.sh install suite
</pre></div>