on master help sign in
docs: add utils/lxc.sh docs, normalize filtron, morty & searx docs

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

commitdd53c45a2cb46f882a856869de26215942749cba authorMarkus Heiser <markus.heiser@darmarit.de> dateMon 30 Mar 2020, 18:47 (7 years ago) parent4e307ed
8 files changed+146−43
docs/utils/filtron.sh.rst+12−13 docs/utils/index.rst+1 docs/utils/lxc.sh.rst+79 docs/utils/morty.sh.rst+10−1 docs/utils/searx.sh.rst+24−17 utils/filtron.sh+1−1 utils/lxc.sh+7 utils/searx.sh+12−11
docs/utils/filtron.sh.rst+12−13
@@ -27,8 +27,8 @@ The script adds a ``${SERVICE_USER}`` (default:``filtron``) and installs filtron
2727into this user account:
2828
2929#. Create a separated user account (``filtron``).
30−#. Download and install Go_ binary in users $HOME (``~filtron``).
31−#. Install filtron with the package management of Go_ (``go get -v -u
30+#. Download and install Go_ binary in user's $HOME (``~filtron``).
31+#. Install filtron with the package management from Go_ (``go get -v -u
3232 github.com/asciimoo/filtron``)
3333#. Setup a proper rule configuration :origin:`[ref]
3434 <utils/templates/etc/filtron/rules.json>` (``/etc/filtron/rules.json``).
@@ -36,6 +36,16 @@ into this user account:
3636 <utils/templates/lib/systemd/system/filtron.service>`
3737 (``/lib/systemd/system/filtron.service``).
3838
39+.. _filtron.sh overview:
40+
41+Overview
42+========
43+
44+The ``--help`` output of the script is largely self-explanatory
45+(:ref:`toolboxing common`):
46+
47+.. program-output:: ../utils/filtron.sh --help
48+
3949.. _reverse proxy:
4050
4151Public Reverse Proxy
@@ -63,14 +73,3 @@ To install searx in your public HTTP server use:
6373 $ sudo -H a2enmod headers
6474 $ sudo -H a2enmod proxy
6575 $ sudo -H a2enmod proxy_http
66−
67−.. _filtron.sh overview:
68−
69−Overview
70−========
71−
72−The ``--help`` output of the script is largely self-explanatory
73−(:ref:`toolboxing common`):
74−
75−.. program-output:: ../utils/filtron.sh --help
76−
docs/utils/index.rst+1
@@ -15,6 +15,7 @@ developers.
1515 searx.sh
1616 filtron.sh
1717 morty.sh
18+ lxc.sh
1819
1920.. _toolboxing common:
2021
docs/utils/lxc.sh.rstnew file+79
@@ -0,0 +1,79 @@
1+
2+
3+.. _snap: https://snapcraft.io
4+.. _snapcraft LXD: https://snapcraft.io/lxd
5+.. _LXC/LXD Image Server: https://uk.images.linuxcontainers.org/
6+.. _LXC: https://linuxcontainers.org/lxc/introduction/
7+.. _LXD: https://linuxcontainers.org/lxd/introduction/
8+.. _`LXD@github`: https://github.com/lxc/lxd
9+
10+.. _lxc.sh:
11+
12+================
13+``utils/lxc.sh``
14+================
15+
16+.. sidebar:: further reading
17+
18+ - snap_, `snapcraft LXD`_
19+ - LXC_, LXD_
20+ - `LXC/LXD Image Server`_
21+ - `LXD@github`_
22+
23+With the use of *Linux Containers* (LXC_) we can scale our tasks over a stack of
24+containers, what we call the: *lxc suite*. Before you can start with
25+containers, you need to install and initiate LXD_ once::
26+
27+ $ snap install lxd
28+ $ lxd init --auto
29+
30+The *searx suite* (:origin:`lxc-searx.env <utils/lxc-searx.env>`) is loaded by
31+default, every time you start the ``lxc.sh`` script (you do not need to care
32+about). To make use of the containers from the *searx suite*, you have to build
33+the :ref:`LXC suite containers <lxc.sh --help>` first. But be warned, this
34+might take some time::
35+
36+ $ sudo -H ./utils/lxc.sh build
37+
38+A cup of coffee later, your LXC suite is build up and you can run whatever task
39+you want / in a selected or even in all :ref:`LXC suite containers <lxc.sh
40+--help>`. Each container shares the root folder of the repository and the
41+command ``utils/lxc.sh cmd`` handles relative path names *transparent*::
42+
43+ $ sudo -H ./utils/lxc.sh cmd -- ls -la Makefile
44+ ...
45+ [searx-ubu2004] -rw-r--r-- 1 root root 7603 Mar 30 11:54 Makefile
46+ [searx-fedora31] -rw-r--r-- 1 root root 7603 Mar 30 11:54 Makefile
47+ [searx-archlinux] -rw-r--r-- 1 root root 7603 Mar 30 11:54 Makefile
48+
49+With this in mind, you can run :ref:`searx.sh` and install packages, needed by
50+searx::
51+
52+ $ sudo -H ./utils/lxc.sh cmd -- ./utils/searx.sh install packages
53+
54+And run one of the :origin:`Makefile` targets::
55+
56+ $ sudo -H ./utils/lxc.sh cmd -- make test.sh
57+
58+You can install a *buildhost environment* into the containers (time for another
59+cup of coffee)::
60+
61+ $ sudo -H ./utils/lxc.sh install buildhost
62+
63+If you want to get rid off all the containers, just type::
64+
65+ $ sudo -H ./utils/lxc.sh remove
66+
67+To clean up your local images use::
68+
69+ $ sudo -H ./utils/lxc.sh remove images
70+
71+.. _lxc.sh --help:
72+
73+Overview
74+========
75+
76+The ``--help`` output of the script is largely self-explanatory:
77+
78+.. program-output:: ../utils/lxc.sh --help
79+
docs/utils/morty.sh.rst+10−1
@@ -1,6 +1,7 @@
11
22.. _morty: https://github.com/asciimoo/morty
33.. _morty's README: https://github.com/asciimoo/morty
4+.. _Go: https://golang.org/
45
56.. _morty.sh:
67
@@ -22,7 +23,15 @@ running the command:
2223 sudo -H ./utils/morty.sh install all
2324
2425The script adds a ``${SERVICE_USER}`` (default:``morty``) and installs morty_
25−into this user account.
26+into this user account:
27+
28+#. Create a separated user account (``morty``).
29+#. Download and install Go_ binary in user's $HOME (``~morty``).
30+#. Install morty_ with the package management from Go_ (``go get -v -u
31+ github.com/asciimoo/morty``)
32+#. Setup a systemd service unit :origin:`[ref]
33+ <utils/templates/lib/systemd/system/morty.service>`
34+ (``/lib/systemd/system/morty.service``).
2635
2736.. hint::
2837
docs/utils/searx.sh.rst+24−17
@@ -29,45 +29,52 @@ into this user account. The installation is described in chapter
2929
3030.. _intranet reverse proxy:
3131
32−Intranet Reverse Proxy
33−======================
32+Overview
33+========
3434
35−To install searx in your intranet HTTP server use:
35+The ``--help`` output of the script is largely self-explanatory
36+(:ref:`toolboxing common`):
3637
37−.. code:: bash
38+.. program-output:: ../utils/searx.sh --help
3839
39− sudo -H ./utils/searx.sh apache install
40+
41+Intranet Reverse Proxy
42+======================
4043
4144.. warning::
4245
4346 This setup is **not** suitable **for public instances**, go on with
4447 :ref:`reverse proxy`!
4548
49+To install searx in your intranet HTTP server use:
50+
51+.. code:: bash
52+
53+ sudo -H ./utils/searx.sh apache install
54+
4655.. tabs::
4756
4857 .. group-tab:: apache
4958
5059 .. literalinclude:: ../../utils/templates/etc/apache2/sites-available/searx.conf:uwsgi
51− :language: apache
60+ :language: apache
5261
5362 .. tabs::
5463
55− .. group-tab:: Ubuntu / debian
64+ .. group-tab:: Ubuntu / debian
5665
57− .. code-block:: sh
66+ .. code-block:: sh
5867
59− $ sudo -H apt install libapache2-mod-uwsgi
68+ $ sudo -H apt install libapache2-mod-uwsgi
6069
61− .. group-tab:: Arch Linux
70+ .. group-tab:: Arch Linux
6271
63− .. code-block:: sh
72+ .. code-block:: sh
6473
65− $ sudo pacman -S uwsgi
74+ $ sudo -H pacman -S uwsgi
6675
67−Overview
68−========
76+ .. group-tab:: Fedora / RHEL
6977
70−The ``--help`` output of the script is largely self-explanatory
71−(:ref:`toolboxing common`):
78+ .. code-block:: sh
7279
73−.. program-output:: ../utils/searx.sh --help
80+ $ sudo -H dnf install uwsgi
utils/filtron.sh+1−1
@@ -90,7 +90,7 @@ inspect service
9090 show service status and log
9191option
9292 set one of the available options
93−apache : ${PUBLIC_URL}
93+apache (${PUBLIC_URL})
9494 :install: apache site with a reverse proxy (ProxyPass)
9595 :remove: apache site ${APACHE_FILTRON_SITE}
9696
utils/lxc.sh+7
@@ -324,6 +324,13 @@ lxc_delete_images_localy() {
324324 lxc_delete_local_image "$i"
325325 done
326326 fi
327+
328+ for i in $(lxc image list --format csv | grep '^,' | sed 's/,\([^,]*\).*$/\1/'); do
329+ if ask_yn "Image $i has no alias, do you want to delete the image?" Yn; then
330+ lxc_delete_local_image "$i"
331+ fi
332+ done
333+
327334 echo
328335 lxc image list local:
329336}
utils/searx.sh+12−11
@@ -44,30 +44,33 @@ SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket"
4444SEARX_PACKAGES_debian="\
4545python3-dev python3-babel python3-venv
4646uwsgi uwsgi-plugin-python3
47−git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev"
47+git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev
48+shellcheck"
4849
4950BUILD_PACKAGES_debian="\
50−shellcheck graphviz imagemagick texlive-xetex librsvg2-bin
51+graphviz imagemagick texlive-xetex librsvg2-bin
5152texlive-latex-recommended texlive-extra-utils ttf-dejavu"
5253
5354# pacman packages
5455SEARX_PACKAGES_arch="\
5556python python-pip python-lxml python-babel
5657uwsgi uwsgi-plugin-python
57−git base-devel libxml2"
58+git base-devel libxml2
59+shellcheck"
5860
5961BUILD_PACKAGES_arch="\
60−shellcheck graphviz imagemagick texlive-bin extra/librsvg
62+graphviz imagemagick texlive-bin extra/librsvg
6163texlive-core texlive-latexextra ttf-dejavu"
6264
6365# dnf packages
6466SEARX_PACKAGES_fedora="\
6567python python-pip python-lxml python-babel
6668uwsgi uwsgi-plugin-python3
67−git @development-tools libxml2"
69+git @development-tools libxml2
70+ShellCheck"
6871
6972BUILD_PACKAGES_fedora="\
70−ShellCheck graphviz graphviz-gd ImageMagick librsvg2-tools
73+graphviz graphviz-gd ImageMagick librsvg2-tools
7174texlive-xetex-bin texlive-collection-fontsrecommended
7275texlive-collection-latex dejavu-sans-fonts dejavu-serif-fonts
7376dejavu-sans-mono-fonts"
@@ -76,23 +79,21 @@ case $DIST_ID in
7679 ubuntu|debian)
7780 SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
7881 BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
82+ APACHE_APT_PACKAGES="libapache2-mod-uwsgi"
7983 ;;
8084 arch)
8185 SEARX_PACKAGES="${SEARX_PACKAGES_arch}"
8286 BUILD_PACKAGES="${BUILD_PACKAGES_arch}"
87+ APACHE_APT_PACKAGES="uwsgi"
8388 ;;
8489 fedora)
8590 SEARX_PACKAGES="${SEARX_PACKAGES_fedora}"
8691 BUILD_PACKAGES="${BUILD_PACKAGES_fedora}"
92+ APACHE_APT_PACKAGES="uwsgi"
8793 ;;
8894esac
8995
9096# Apache Settings
91−
92−APACHE_APT_PACKAGES="\
93− libapache2-mod-uwsgi \
94−"
95−
9697APACHE_SEARX_SITE="searx.conf"
9798
9899# shellcheck disable=SC2034