File: install.rst

package info (click to toggle)
mistral 21.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,140 kB
  • sloc: python: 54,052; sh: 701; makefile: 58
file content (328 lines) | stat: -rw-r--r-- 8,051 bytes parent folder | download | duplicates (2)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
=====================
Install and configure
=====================

This section describes how to install and configure the
Workflow Service, code-named mistral, on the controller node.

.. note::

    Mistral can be used in standalone mode or it can work with OpenStack.

If Mistral is used with OpenStack, you must already have a working OpenStack
environment with at least the following components installed:

- Keystone with API v3 support

Note that installation and configuration may vary by distribution.

Overview
--------

The Workflow service consists of the following components:

``Mistral API`` service
  Provides a REST API for operating and monitoring workflow executions.

``Mistral Engine`` service
  Controls workflow executions and handles their data flow, places finished
  tasks in a queue, transfers data from task to task, and deals with condition
  transitions, and so on.

``Mistral Executor`` service
  Executes task actions, picks up the tasks from the queue, runs actions, and
  sends results back to the engine.

``Mistral Notifier`` service
  Send notifications based on state of workflow and task executions.
  `This service is optional`.

``Mistral Event Engine`` service
  Create workflow executions based on external events (like RabbitMQ, HTTP,
  kafka, etc.).
  `This service is optional`.

The mistral project is also providing the following python libraries:

``mistral-dashboard``
  Mistral Dashboard is a Horizon (OpenSack dashboard) plugin.

``python-mistralclient``
  Python client API and Command Line Interface.

``mistral-lib``
  A library used by mistral internals.

``mistral-extra``
  A collection of extra actions that could be installed to extend mistral
  standard actions with openstack ones (by default mistral is not having any
  OpenStack related action).

Prerequisites
-------------

Install the following dependencies:

On ``apt`` based distributions:

.. code-block:: console

    $ apt-get update
    $ apt-get install python3 python3-venv python3-pip git

On ``dnf`` based distributions:

.. code-block:: console

    $ dnf update
    $ dnf install python3 python3-venv python3-pip git

.. note::

    you may need to adapt the previous commands based on your distribution.

Installation
------------

.. note::

    For instructions on how to install Mistral using devstack, refer to
    :doc:`Mistral Devstack Installation <../../contributor/devstack>`

Clone the repo and go to the repo directory:

.. code-block:: console

    $ git clone https://opendev.org/openstack/mistral
    $ cd mistral

Create a venv:

.. code-block:: console

    $ python3 -m venv venv
    $ source venv/bin/activate

Now install mistral:

.. code-block:: console

    $ pip install \
      -c https://releases.openstack.org/constraints/upper/master \
      -r requirements.txt \
      .

.. note::

    You may need to adjust the constraints file based on the release
    of mistral you are installing

Generate the configuration file:

.. code-block:: console

    $ pip install tox
    $ tox -egenconfig

Create the mistral directory and copy the example configuration file:

.. code-block:: console

    $ mkdir /etc/mistral
    $ cp etc/mistral.conf.sample /etc/mistral/mistral.conf

Edit the configuration file:

.. code-block:: console

    $ vi /etc/mistral/mistral.conf

You may also want to install the `mistral-extra` package to have the
opentack actions available (but this is not mandatory):

.. code-block:: console

    $ pip install mistral-extra


Configuring Mistral
-------------------

Refer :doc:`../configuration/index` to find general information on how to
configure Mistral server.


Before The First Run
--------------------

After the installation, you will see the **mistral-server** and
**mistral-db-manage** commands in your virtual env.

The **mistral-db-manage** command can be used for database migrations.

Update the database to the latest revision:

.. code-block:: console

    # For MySQL / MariaDB / PostgreSQL
    $ mistral-db-manage upgrade head

    # For SQLite - do not use sqlite in production!
    # e.g. connection = 'sqlite:////var/lib/mistral.sqlite'
    $ python tools/sync_db.py

Before starting the Mistral server, run the *mistral-db-manage populate*
command. It creates the DB with all the standard actions and standard workflows
that Mistral provides to all Mistral users.:

.. code-block:: console

    $ mistral-db-manage populate

For more detailed information on the *mistral-db-manage* script, see
the :doc:`Mistral Upgrade Guide </admin/upgrade_guide>`.


Running Mistral server
----------------------

To run the Mistral components, execute the following command in a shell:

.. code-block:: console

    $ mistral-server --server all

.. note::

    in this situation API will start only one worker! If you need more than
    worker for you API, you should start the API with uWSGI (see below)

Running Mistral components separately
-------------------------------------

You can choose to split the Mistral component execution on more than one
server, e.g. to start only the engine:

.. code-block:: console

    $ mistral-server --server engine

The --server command line option can be a comma delimited list, so you can
build combination of components, like this:

.. code-block:: console

    $ mistral-server --server engine,executor

The valid options are:

* all (by default if not specified)
* api
* engine
* executor
* event-engine
* notifier

Running Mistral API with uWSGI
------------------------------

The WSGI application
~~~~~~~~~~~~~~~~~~~~

One downside of running ``mistral-server --server api`` directly is that it
will start only one process (worker) to handle HTTP requests.

While this may be enough for small/dev deployments, it may not for production.

In that situation, Mistral provides a WSGI application at
``mistral.wsgi:application`` that can be used with any WSGI server.

The below example uses uWSGI


Using uWSGI
~~~~~~~~~~~

Install uWSGI:

.. code-block:: console

    $ pip install uwsgi


Create a uWSGI configuration file (e.g., ``/etc/uwsgi/mistral.ini``):

.. code-block:: cfg

    [uwsgi]
    # Listen on port 8989 and start as a full web server
    http-socket = 0.0.0.0:8989

    # Stats on port 9191
    stats = 0.0.0.0:9191

    # App to start
    virtualenv = /opt/openstack/mistral/
    module = mistral.wsgi:application

    # load apps in each worker instead of the master
    lazy-apps = true

    # Number of processes
    processes = 4

    # Will kill processes that run more that 60s
    harakiri = 60

    # Enable threads
    enable-threads = true

    # Gracefully manage processes
    master = true

    # Thunder-lock - serialize accept() usage (if possible)
    thunder-lock = true


Start uWSGI:

.. code-block:: console

    $ uwsgi --ini /etc/uwsgi/mistral.ini


Passing Configuration Options
------------------------------

By default, Mistral will use its standard configuration file search paths:

* ``/etc/mistral/mistral.conf``
* ``/etc/mistral/mistral.conf.d/``
* ``/etc/mistral.conf.d/``
* many others, see:
  https://docs.openstack.org/oslo.config/latest/configuration/options.html

You can also provide ``config-dir`` or ``config-file`` options to
``mistral-server`` command line to provide a custom file/folder:

.. code-block:: console

    $ mistral-server --config-dir /etc/mycustomdir/

Note that, when using ``uwsgi``, you won't be able to provide such params. In
that situation, you can use ``MISTRAL_CONFIG_DIR`` and/or
``MISTRAL_CONFIG_FILE`` environment variable instead:

.. code-block:: cfg

    [uwsgi]
    ...
    env = MISTRAL_CONFIG_DIR=/etc/mycustomdir/

.. _install-osa:

Deploying with OpenStack-Ansible
--------------------------------
You can also deploy and set up Mistral using `OpenStack-Ansible <https://docs.openstack.org/openstack-ansible/latest/>`_ by following
the `Mistral role for OpenStack-Ansible <https://docs.openstack.org/openstack-ansible-os_mistral/latest/>`_
which installs and configures Mistral as part of your OpenStack deployment.