Package: mistral
Workflow Service for OpenStack cloud.PrerequisitesIt is necessary to install some specific system libs for installing Mistral. They can be installed on most popular operating system using their package manager (for Ubuntu -apt, for Fedora, CentOS -yum, for Mac OS -brewormacports).
The list of needed packages is shown below:python-devpython-setuptoolspython-piplibffi-devlibxslt1-dev (or libxslt-dev)libxml2-devlibyaml-devlibssl-devIn case of ubuntu, just run:apt-get install python-dev python-setuptools libffi-dev libxslt1-dev libxml2-dev libyaml-dev libssl-devMistral can be used without authentication at all or it can works with OpenStack.In case of OpenStack, it worksonly on Keystone v3, make sureKeystone v3is installed.InstallationFirst of all, clone the repo and go to the repo directory:git clone https://github.com/stackforge/mistral.git
cd mistralDevstack installationInformation about how to install Mistral with devstack can be found here:https://github.com/stackforge/mistral/tree/master/contrib/devstackVirtualenv installation:toxThis will install necessary virtual environments and run all the project tests. Installing virtual environments may take significant time (~10-15 mins).Local installation:pip install -e .or:python setup.py installConfiguring MistralMistral configuration is needed for getting it work correctly either with real OpenStack environment or without OpenStack environment.Copy mistral.conf:cp etc/mistral.conf.sample etc/mistral.confNote: mistral.conf.sample is the example configuration file.Edit fileetc/mistral.confIf you are not using OpenStack, skip this item.Provide valid keystone auth properties:[keystone_authtoken]
auth_uri = http://<Keystone-host>:5000/v3
identity_uri = http://<Keystone-host:35357/
auth_version = v3
admin_user = <user>
admin_password = <password>
admin_tenant_name = <tenant>If you don’t use OpenStack, provideauth_enable = Falsein config file:[pecan]
auth_enable = FalseAlso, configure rabbit properties:rabbit_userid,rabbit_password,rabbit_hostin sectiondefault.Configure database.SQLite can’t be used in production.UseMySQLorPostreSQLinstead. Here are the steps how to connectMySQLDB to Mistral:Make sure you have installedmysql-serverpackage on your Mistral machine.InstallMySQL driverfor python:pip install mysql-pythonor, if you work in virtualenv, run:tox -evenv -- pip install mysql-pythonCreate the database and grant privileges:mysql -u root -p

CREATE DATABASE mistral;
USE mistral
GRANT ALL ON mistral.* TO 'root'@'localhost';Configure connection in Mistral config:[database]
connection = mysql://root:@localhost:3306/mistralBefore the first runBefore starting Mistral server, run sync_db script. It prepares the DB, creates in it all standard actions and standard workflows which Mistral provides for all mistral users.If you use virtualenv:tools/sync_db.sh --config-file path_to_config*Or run sync_db directly:python tools/sync_db.py --config-file path_to_config*Note: After local installation you will see **mistral-server*andmistral-db-managecommands in your environment*.Migrationsmistral-db-managecommand can be used for migrations. If Mistral is not installed in system then this script can befound atmistral/db/sqlalchemy/migration/cli.py, it can be executed using Python.For updating the database to the latest revision type:mistral-db-manage --config-file <path-to-mistral.conf> upgrade headFor more detailed information aboutmistral-db-managescript please see migration readme here -https://github.com/stackforge/mistral/blob/master/mistral/db/sqlalchemy/migration/alembic_migrations/README.mdRunning Mistral API serverTo run Mistral API server perform the following command in a shell:tox -evenv -- python mistral/cmd/launch.py --server api --config-file path_to_config*Running Mistral EnginesTo run Mistral Engine perform the following command in a shell:tox -evenv -- python mistral/cmd/launch.py --server engine --config-file path_to_config*Running Mistral Task ExecutorsTo run Mistral Task Executor instance perform the following command in a shell:tox -evenv -- python mistral/cmd/launch.py --server executor --config-file path_to_configNote that at least one Engine instance and one Executor instance should be running so that workflow tasks are processed by Mistral.If it is needed to run some tasks on specific executor thentask affinityfeature can be used to send these tasks directly to specific executor. In configuration file edit section “executor”hostproperty:[executor]
host = my_favorite_executorThen start (restart) executor. Usetargettask property to specify this executor:... Workflow YAML ...
task1:
  ...
  target: my_favorite_executor
... Workflow YAML ...Running Multiple Mistral Servers Under the Same ProcessTo run more than one server (API, Engine, or Task Executor) on the same process, perform the following command in a shell:tox -evenv -- python mistral/cmd/launch.py --server api,engine --config-file path_to_configThe –server command line option can be a comma delimited list. The valid options are “all” (by default if not specified) or any combination of “api”, “engine”, and “executor”. It’s important to note that the “fake” transport for the rpc_backend defined in the config file should only be used if “all” the Mistral servers are launched on the same process. Otherwise, messages do not get delivered if the Mistral servers are launched on different processes because the “fake” transport is using an in process queue.Mistral clientPython-mistralclient is available here -https://github.com/stackforge/python-mistralclientDebuggingTo debug using a local engine and executor without dependencies such as RabbitMQ, create etc/mistral.conf with the following settings:[DEFAULT]
rpc_backend = fake

[pecan]
auth_enable = Falseand run in pdb, PyDev or PyCharm:mistral/cmd/launch.py --server all --config-file etc/mistral.conf --use-debuggerRunning examplesTo run the examples find them in mistral-extra repository (https://github.com/stackforge/mistral-extra) and follow the instructions on each example.TestsThere is an ability to run part of functional tests in non-openstack mode locally. To do this:setauth_enable = Falsein themistral.confand restart Mistralexecute:./run_functional_tests.shTo run tests for only one version need to specify it: bash run_functional_tests.sh v1More information about automated tests for Mistral can be found here:https://wiki.openstack.org/wiki/Mistral/Testing