docs: add utils/lxc.sh docs, normalize filtron, morty & searx docs

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-03-30 18:47:01 +02:00
parent 4e307edb2d
commit dd53c45a2c
8 changed files with 164 additions and 61 deletions

View File

@ -27,8 +27,8 @@ The script adds a ``${SERVICE_USER}`` (default:``filtron``) and installs filtron
into this user account:
#. Create a separated user account (``filtron``).
#. Download and install Go_ binary in users $HOME (``~filtron``).
#. Install filtron with the package management of Go_ (``go get -v -u
#. Download and install Go_ binary in user's $HOME (``~filtron``).
#. Install filtron with the package management from Go_ (``go get -v -u
github.com/asciimoo/filtron``)
#. Setup a proper rule configuration :origin:`[ref]
<utils/templates/etc/filtron/rules.json>` (``/etc/filtron/rules.json``).
@ -36,6 +36,16 @@ into this user account:
<utils/templates/lib/systemd/system/filtron.service>`
(``/lib/systemd/system/filtron.service``).
.. _filtron.sh overview:
Overview
========
The ``--help`` output of the script is largely self-explanatory
(:ref:`toolboxing common`):
.. program-output:: ../utils/filtron.sh --help
.. _reverse proxy:
Public Reverse Proxy
@ -63,14 +73,3 @@ To install searx in your public HTTP server use:
$ sudo -H a2enmod headers
$ sudo -H a2enmod proxy
$ sudo -H a2enmod proxy_http
.. _filtron.sh overview:
Overview
========
The ``--help`` output of the script is largely self-explanatory
(:ref:`toolboxing common`):
.. program-output:: ../utils/filtron.sh --help

View File

@ -15,6 +15,7 @@ developers.
searx.sh
filtron.sh
morty.sh
lxc.sh
.. _toolboxing common:

79
docs/utils/lxc.sh.rst Normal file
View File

@ -0,0 +1,79 @@
.. _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
.. _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
containers, what we call the: *lxc suite*. Before you can start with
containers, you need to install and initiate LXD_ once::
$ snap install lxd
$ lxd init --auto
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). To make use of the containers from the *searx suite*, you have to build
the :ref:`LXC suite containers <lxc.sh --help>` first. But be warned, this
might take some time::
$ 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
--help>`. Each container shares the root folder of the repository and the
command ``utils/lxc.sh cmd`` handles relative path names *transparent*::
$ sudo -H ./utils/lxc.sh cmd -- ls -la Makefile
...
[searx-ubu2004] -rw-r--r-- 1 root root 7603 Mar 30 11:54 Makefile
[searx-fedora31] -rw-r--r-- 1 root root 7603 Mar 30 11:54 Makefile
[searx-archlinux] -rw-r--r-- 1 root root 7603 Mar 30 11:54 Makefile
With this in mind, you can run :ref:`searx.sh` and install packages, needed by
searx::
$ sudo -H ./utils/lxc.sh cmd -- ./utils/searx.sh install packages
And run one of the :origin:`Makefile` targets::
$ sudo -H ./utils/lxc.sh cmd -- make test.sh
You can install a *buildhost environment* into the containers (time for another
cup of coffee)::
$ sudo -H ./utils/lxc.sh install buildhost
If you want to get rid off all the containers, just type::
$ sudo -H ./utils/lxc.sh remove
To clean up your local images use::
$ sudo -H ./utils/lxc.sh remove images
.. _lxc.sh --help:
Overview
========
The ``--help`` output of the script is largely self-explanatory:
.. program-output:: ../utils/lxc.sh --help

View File

@ -1,6 +1,7 @@
.. _morty: https://github.com/asciimoo/morty
.. _morty's README: https://github.com/asciimoo/morty
.. _Go: https://golang.org/
.. _morty.sh:
@ -22,7 +23,15 @@ running the command:
sudo -H ./utils/morty.sh install all
The script adds a ``${SERVICE_USER}`` (default:``morty``) and installs morty_
into this user account.
into this user account:
#. Create a separated user account (``morty``).
#. Download and install Go_ binary in user's $HOME (``~morty``).
#. Install morty_ with the package management from Go_ (``go get -v -u
github.com/asciimoo/morty``)
#. Setup a systemd service unit :origin:`[ref]
<utils/templates/lib/systemd/system/morty.service>`
(``/lib/systemd/system/morty.service``).
.. hint::

View File

@ -29,20 +29,29 @@ into this user account. The installation is described in chapter
.. _intranet reverse proxy:
Overview
========
The ``--help`` output of the script is largely self-explanatory
(:ref:`toolboxing common`):
.. program-output:: ../utils/searx.sh --help
Intranet Reverse Proxy
======================
.. warning::
This setup is **not** suitable **for public instances**, go on with
:ref:`reverse proxy`!
To install searx in your intranet HTTP server use:
.. code:: bash
sudo -H ./utils/searx.sh apache install
.. warning::
This setup is **not** suitable **for public instances**, go on with
:ref:`reverse proxy`!
.. tabs::
.. group-tab:: apache
@ -62,12 +71,10 @@ To install searx in your intranet HTTP server use:
.. code-block:: sh
$ sudo pacman -S uwsgi
$ sudo -H pacman -S uwsgi
Overview
========
.. group-tab:: Fedora / RHEL
The ``--help`` output of the script is largely self-explanatory
(:ref:`toolboxing common`):
.. code-block:: sh
.. program-output:: ../utils/searx.sh --help
$ sudo -H dnf install uwsgi

View File

@ -90,7 +90,7 @@ inspect service
show service status and log
option
set one of the available options
apache : ${PUBLIC_URL}
apache (${PUBLIC_URL})
:install: apache site with a reverse proxy (ProxyPass)
:remove: apache site ${APACHE_FILTRON_SITE}

View File

@ -324,6 +324,13 @@ lxc_delete_images_localy() {
lxc_delete_local_image "$i"
done
fi
for i in $(lxc image list --format csv | grep '^,' | sed 's/,\([^,]*\).*$/\1/'); do
if ask_yn "Image $i has no alias, do you want to delete the image?" Yn; then
lxc_delete_local_image "$i"
fi
done
echo
lxc image list local:
}

View File

@ -44,30 +44,33 @@ SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket"
SEARX_PACKAGES_debian="\
python3-dev python3-babel python3-venv
uwsgi uwsgi-plugin-python3
git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev"
git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev
shellcheck"
BUILD_PACKAGES_debian="\
shellcheck graphviz imagemagick texlive-xetex librsvg2-bin
graphviz imagemagick texlive-xetex librsvg2-bin
texlive-latex-recommended texlive-extra-utils ttf-dejavu"
# pacman packages
SEARX_PACKAGES_arch="\
python python-pip python-lxml python-babel
uwsgi uwsgi-plugin-python
git base-devel libxml2"
git base-devel libxml2
shellcheck"
BUILD_PACKAGES_arch="\
shellcheck graphviz imagemagick texlive-bin extra/librsvg
graphviz imagemagick texlive-bin extra/librsvg
texlive-core texlive-latexextra ttf-dejavu"
# dnf packages
SEARX_PACKAGES_fedora="\
python python-pip python-lxml python-babel
uwsgi uwsgi-plugin-python3
git @development-tools libxml2"
git @development-tools libxml2
ShellCheck"
BUILD_PACKAGES_fedora="\
ShellCheck graphviz graphviz-gd ImageMagick librsvg2-tools
graphviz graphviz-gd ImageMagick librsvg2-tools
texlive-xetex-bin texlive-collection-fontsrecommended
texlive-collection-latex dejavu-sans-fonts dejavu-serif-fonts
dejavu-sans-mono-fonts"
@ -76,23 +79,21 @@ case $DIST_ID in
ubuntu|debian)
SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
APACHE_APT_PACKAGES="libapache2-mod-uwsgi"
;;
arch)
SEARX_PACKAGES="${SEARX_PACKAGES_arch}"
BUILD_PACKAGES="${BUILD_PACKAGES_arch}"
APACHE_APT_PACKAGES="uwsgi"
;;
fedora)
SEARX_PACKAGES="${SEARX_PACKAGES_fedora}"
BUILD_PACKAGES="${BUILD_PACKAGES_fedora}"
APACHE_APT_PACKAGES="uwsgi"
;;
esac
# Apache Settings
APACHE_APT_PACKAGES="\
libapache2-mod-uwsgi \
"
APACHE_SEARX_SITE="searx.conf"
# shellcheck disable=SC2034