summaryrefslogtreecommitdiff
path: root/docs/utils/lxc.sh.rst
blob: 68577ea13598b6d46472584416d6692ed6dba60f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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