2020-03-30 18:47:01 +02:00
|
|
|
|
|
|
|
.. _snap: https://snapcraft.io
|
|
|
|
.. _snapcraft LXD: https://snapcraft.io/lxd
|
|
|
|
.. _LXC/LXD Image Server: https://uk.images.linuxcontainers.org/
|
|
|
|
.. _LXC: https://linuxcontainers.org/lxc/introduction/
|
|
|
|
.. _LXD: https://linuxcontainers.org/lxd/introduction/
|
|
|
|
.. _`LXD@github`: https://github.com/lxc/lxd
|
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
.. _archlinux: https://www.archlinux.org/
|
|
|
|
|
2020-03-30 18:47:01 +02:00
|
|
|
.. _lxc.sh:
|
|
|
|
|
|
|
|
================
|
|
|
|
``utils/lxc.sh``
|
|
|
|
================
|
|
|
|
|
|
|
|
.. sidebar:: further reading
|
|
|
|
|
|
|
|
- snap_, `snapcraft LXD`_
|
|
|
|
- LXC_, LXD_
|
|
|
|
- `LXC/LXD Image Server`_
|
|
|
|
- `LXD@github`_
|
|
|
|
|
|
|
|
With the use of *Linux Containers* (LXC_) we can scale our tasks over a stack of
|
2020-03-31 18:25:40 +02:00
|
|
|
containers, what we call the: *lxc suite*. The *searx suite*
|
|
|
|
(:origin:`lxc-searx.env <utils/lxc-searx.env>`) is loaded by default, every time
|
|
|
|
you start the ``lxc.sh`` script (*you do not need to care about*).
|
|
|
|
|
|
|
|
Before you can start with containers, you need to install and initiate LXD_
|
|
|
|
once::
|
2020-03-30 18:47:01 +02:00
|
|
|
|
|
|
|
$ snap install lxd
|
|
|
|
$ lxd init --auto
|
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
To make use of the containers from the *searx suite*, you have to build the
|
2020-04-03 17:08:42 +02:00
|
|
|
:ref:`LXC suite containers <lxc.sh help>` initial. But be warned, **this might
|
|
|
|
take some time**::
|
2020-03-30 18:47:01 +02:00
|
|
|
|
|
|
|
$ sudo -H ./utils/lxc.sh build
|
|
|
|
|
|
|
|
A cup of coffee later, your LXC suite is build up and you can run whatever task
|
|
|
|
you want / in a selected or even in all :ref:`LXC suite containers <lxc.sh
|
2020-04-03 17:08:42 +02:00
|
|
|
help>`. If you do not want to build all containers, **you can build just
|
|
|
|
one**::
|
|
|
|
|
|
|
|
$ sudo -H ./utils/lxc.sh build searx-ubu1804
|
2020-03-31 18:25:40 +02:00
|
|
|
|
|
|
|
*Good to know ...*
|
|
|
|
|
2020-06-24 17:49:38 +02:00
|
|
|
Each container shares the root folder of the repository and the command
|
|
|
|
``utils/lxc.sh cmd`` **handles relative path names transparent**, compare output
|
|
|
|
of::
|
2020-03-30 18:47:01 +02:00
|
|
|
|
|
|
|
$ sudo -H ./utils/lxc.sh cmd -- ls -la Makefile
|
|
|
|
...
|
2020-04-03 17:08:42 +02:00
|
|
|
|
|
|
|
In the containers, you can run what ever you want, e.g. to start a bash use::
|
|
|
|
|
|
|
|
$ sudo -H ./utils/lxc.sh cmd searx-ubu1804 bash
|
|
|
|
INFO: [searx-ubu1804] bash
|
|
|
|
root@searx-ubu1804:/share/searx#
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
If there comes the time you want to **get rid off all** the containers and
|
|
|
|
**clean up local images** just type::
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
$ sudo -H ./utils/lxc.sh remove
|
|
|
|
$ sudo -H ./utils/lxc.sh remove images
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-06-24 17:49:38 +02:00
|
|
|
.. _lxc.sh install suite:
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
Install suite
|
|
|
|
=============
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
To install the complete :ref:`searx suite (includes searx, morty & filtron)
|
|
|
|
<lxc-searx.env>` into all LXC_ use::
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
$ sudo -H ./utils/lxc.sh install suite
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
The command above installs a searx suite (see :ref:`installation scripts`). To
|
|
|
|
get the IP (URL) of the filtron service in the containers use ``show suite``
|
|
|
|
command. To test instances from containers just open the URLs in your
|
|
|
|
WEB-Browser::
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
$ sudo ./utils/lxc.sh show suite | grep filtron
|
2020-04-19 12:34:37 +02:00
|
|
|
[searx-ubu1604] INFO: (eth0) filtron: http://n.n.n.246:4004/ http://n.n.n.246/searx
|
|
|
|
[searx-ubu1804] INFO: (eth0) filtron: http://n.n.n.147:4004/ http://n.n.n.147/searx
|
|
|
|
[searx-ubu1910] INFO: (eth0) filtron: http://n.n.n.140:4004/ http://n.n.n.140/searx
|
|
|
|
[searx-ubu2004] INFO: (eth0) filtron: http://n.n.n.18:4004/ http://n.n.n.18/searx
|
|
|
|
[searx-fedora31] INFO: (eth0) filtron: http://n.n.n.46:4004/ http://n.n.n.46/searx
|
|
|
|
[searx-archlinux] INFO: (eth0) filtron: http://n.n.n.32:4004/ http://n.n.n.32/searx
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-04-19 12:34:37 +02:00
|
|
|
To :ref:`install a nginx <installation nginx>` reverse proxy for filtron and
|
|
|
|
morty use (or alternatively use :ref:`apache <installation apache>`)::
|
|
|
|
|
|
|
|
sudo -H ./utils/lxc.sh cmd -- FORCE_TIMEOUT=0 ./utils/filtron.sh nginx install
|
|
|
|
sudo -H ./utils/lxc.sh cmd -- FORCE_TIMEOUT=0 ./utils/morty.sh nginx install
|
2020-04-08 18:38:36 +02:00
|
|
|
|
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
Running commands
|
|
|
|
================
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
**Inside containers, you can use make or run scripts** from the
|
|
|
|
:ref:`toolboxing`. By example: to setup a :ref:`buildhosts` and run the
|
|
|
|
Makefile target ``test`` in the archlinux_ container::
|
|
|
|
|
2020-06-18 18:39:56 +02:00
|
|
|
sudo -H ./utils/lxc.sh cmd searx-archlinux ./utils/searx.sh install buildhost
|
2020-03-31 18:25:40 +02:00
|
|
|
sudo -H ./utils/lxc.sh cmd searx-archlinux make test
|
|
|
|
|
|
|
|
|
|
|
|
Setup searx buildhost
|
|
|
|
=====================
|
2020-03-30 18:47:01 +02:00
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
You can **install the searx buildhost environment** into one or all containers.
|
|
|
|
The installation procedure to set up a :ref:`build host<buildhosts>` takes its
|
|
|
|
time. Installation in all containers will take more time (time for another cup
|
|
|
|
of coffee).::
|
|
|
|
|
2020-06-18 18:39:56 +02:00
|
|
|
sudo -H ./utils/lxc.sh cmd -- ./utils/searx.sh install buildhost
|
2020-03-31 18:25:40 +02:00
|
|
|
|
|
|
|
To build (live) documentation inside a archlinux_ container::
|
|
|
|
|
|
|
|
sudo -H ./utils/lxc.sh cmd searx-archlinux make docs-clean docs-live
|
|
|
|
...
|
|
|
|
[I 200331 15:00:42 server:296] Serving on http://0.0.0.0:8080
|
|
|
|
|
|
|
|
To get IP of the container and the port number *live docs* is listening::
|
|
|
|
|
|
|
|
$ sudo ./utils/lxc.sh show suite | grep docs-live
|
|
|
|
...
|
|
|
|
[searx-archlinux] INFO: (eth0) docs-live: http://n.n.n.12:8080/
|
|
|
|
|
|
|
|
|
|
|
|
.. _lxc.sh help:
|
2020-03-30 18:47:01 +02:00
|
|
|
|
|
|
|
Overview
|
|
|
|
========
|
|
|
|
|
|
|
|
The ``--help`` output of the script is largely self-explanatory:
|
|
|
|
|
|
|
|
.. program-output:: ../utils/lxc.sh --help
|
|
|
|
|
2020-03-31 18:25:40 +02:00
|
|
|
|
|
|
|
.. _lxc-searx.env:
|
|
|
|
|
|
|
|
searx suite
|
|
|
|
===========
|
|
|
|
|
|
|
|
.. literalinclude:: ../../utils/lxc-searx.env
|
|
|
|
:language: bash
|