Newer
Older
.. _setup:
Setup
=====
In this chapter the setup of a new VS stack is detailed. Before this step can
be done, the configuration and environment files need to be present. These
files can be added manually or be created in the :ref:`initialization` step.
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
Docker
------
In order to deploy the Docker Swarm stack to the target machine, Docker and
its facilities need to be installed. This step depends on the systems
architecture. On a Debian based system this may look like this:
.. code-block:: bash
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
# add the apt repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
# fetch the package index and install Docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
## TODO: RHEL?
Docker Swarm
------------
Now that Docker is installed, the machine can either create a new swarm or join
an existing one.
To create a new Swarm, the following command can be used:
.. code-block:: bash
docker swarm init
Alternatively, an existing Swarm can be joined. The easiest way to do this, is
to obtain a ``join-token``. On an existing Swarm manager (where a Swarm was
initialized or already joined as manager) run this command:
.. code-block:: bash
docker swarm join-token worker
This prints out a command that can be run on a machine to join the swarm:
.. code-block:: bash
docker swarm join --token <obtained token>
Additional information for swarm management can be obtained in the official
documentation of the project:
https://docs.docker.com/engine/reference/commandline/swarm/
Image retrieval
---------------
Before the Docker images can be used, they have to be retrieved first. With
images from the default repository, this happens automatically. When private
repositories are used, they need to be configured beforehand.
Currently, all images used in VS that are not off-the-shelf are hosted on the
``registry.gitlab.eox.at`` registry. It can be configured to be used with this
command with the correct ``username`` and ``password`` filled in:
.. code-block:: bash
docker login -u <username> -p <password> registry.gitlab.eox.at
Now the relevant images can be pulled:
.. code-block:: bash
docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_core
docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_cache
docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor
docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_client
.. # TODO: ingestor image?
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
Stack Deployment
----------------
Now that a Docker Swarm is established, it is time to deploy the VS as a stack.
This is done using the created Docker Compose configuration files. In order to
enhance the re-usability, these files are split into multiple parts to be used
for both development and final service deployment.
For a development deployment one would do (replace ``name`` with the actual
service identifier:
.. code-block:: bash
docker stack deploy -c docker-compose.<name>.yml -c docker-compose.<name>.dev.yml <name>-pdas
This command actually performs a variety of tasks. First off, it obtains any
missing images, such as the image for the reverse proxy, the database or the
redis key-value store.
When all relevant images are pulled from their respective repository the
services of the stack are initialized. In the default setting, each service is
represented by a single container of its respective service type. When starting
for the first time, the startup procedure takes some time, as everything needs
to be initialized. This includes the creation of the database, user,
required tables and the Django instance.
That process can be supervised using the ``docker service ls`` command, which
lists all available services and their respective status.