Added Devstack integration
- added devstack integration files - added a simple api test (for the devstack-gate job) Partial implements blueprint mistral-devstack-gate-job Change-Id: Ibb859c5eda7719d0e046bf833a6eec69bcbeb8be
This commit is contained in:
parent
e5b8879eb1
commit
55b9dc53ea
20
contrib/devstack/README.rst
Normal file
20
contrib/devstack/README.rst
Normal file
@ -0,0 +1,20 @@
|
||||
1. Follow Devstack documentation to setup a host for Devstack. Then clone
|
||||
Devstack source code.
|
||||
|
||||
2. Copy Mistral integration scripts to Devstack::
|
||||
|
||||
$ cp lib/mistral ${DEVSTACK_DIR}/lib
|
||||
$ cp extras.d/70-mistral.sh ${DEVSTACK_DIR}/extras.d
|
||||
|
||||
3. Create a ``localrc`` file as input to devstack.
|
||||
|
||||
4. The Mistral service is not enabled by default, so it must be
|
||||
enabled in ``localrc`` before running ``stack.sh``. This example ``localrc``
|
||||
file shows all of the settings required for Mistral::
|
||||
|
||||
# Enable Mistral
|
||||
enable_service mistral
|
||||
|
||||
5. Deploy your OpenStack Cloud with Mistral::
|
||||
|
||||
$ ./stack.sh
|
23
contrib/devstack/extras.d/70-mistral.sh
Normal file
23
contrib/devstack/extras.d/70-mistral.sh
Normal file
@ -0,0 +1,23 @@
|
||||
# 70-mistral.sh - DevStack extras script to install Mistral
|
||||
|
||||
if is_service_enabled mistral; then
|
||||
if [[ "$1" == "source" ]]; then
|
||||
# Initial source
|
||||
source $TOP_DIR/lib/mistral
|
||||
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||
echo_summary "Installing mistral"
|
||||
install_mistral
|
||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
echo_summary "Configuring mistral"
|
||||
configure_mistral
|
||||
create_mistral_accounts
|
||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||
echo_summary "Initializing mistral"
|
||||
init_mistral
|
||||
start_mistral
|
||||
fi
|
||||
|
||||
if [[ "$1" == "unstack" ]]; then
|
||||
stop_mistral
|
||||
fi
|
||||
fi
|
167
contrib/devstack/lib/mistral
Normal file
167
contrib/devstack/lib/mistral
Normal file
@ -0,0 +1,167 @@
|
||||
# lib/mistral
|
||||
|
||||
# Dependencies:
|
||||
# ``functions`` file
|
||||
# ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
|
||||
|
||||
# ``stack.sh`` calls the entry points in this order:
|
||||
#
|
||||
# install_mistral
|
||||
# configure_mistral
|
||||
# start_mistral
|
||||
# stop_mistral
|
||||
|
||||
|
||||
# Save trace setting
|
||||
XTRACE=$(set +o | grep xtrace)
|
||||
set -o xtrace
|
||||
|
||||
|
||||
# Defaults
|
||||
# --------
|
||||
|
||||
# Set up default repos
|
||||
MISTRAL_REPO=${MISTRAL_REPO:-${GIT_BASE}/stackforge/mistral.git}
|
||||
MISTRAL_BRANCH=${MISTRAL_BRANCH:-master}
|
||||
|
||||
# Set up default directories
|
||||
MISTRAL_DIR=$DEST/mistral
|
||||
MISTRAL_CONF_DIR=${MISTRAL_CONF_DIR:-/etc/mistral}
|
||||
MISTRAL_CONF_FILE=${MISTRAL_CONF_DIR}/mistral.conf
|
||||
MISTRAL_DEBUG=${MISTRAL_DEBUG:-True}
|
||||
|
||||
MISTRAL_SERVICE_HOST=${MISTRAL_SERVICE_HOST:-$SERVICE_HOST}
|
||||
MISTRAL_SERVICE_PORT=${MISTRAL_SERVICE_PORT:-8989}
|
||||
MISTRAL_SERVICE_PROTOCOL=${MISTRAL_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
||||
|
||||
MISTRAL_ADMIN_USER=${MISTRAL_ADMIN_USER:-mistral}
|
||||
|
||||
# Support entry points installation of console scripts
|
||||
if [[ -d $MISTRAL_DIR/bin ]]; then
|
||||
MISTRAL_BIN_DIR=$MISTRAL_DIR/bin
|
||||
else
|
||||
MISTRAL_BIN_DIR=$(get_python_exec_prefix)
|
||||
fi
|
||||
|
||||
# create_mistral_accounts() - Set up common required mistral accounts
|
||||
#
|
||||
# Tenant User Roles
|
||||
# ------------------------------
|
||||
# service mistral admin
|
||||
function create_mistral_accounts() {
|
||||
if ! is_service_enabled key; then
|
||||
return
|
||||
fi
|
||||
|
||||
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
|
||||
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
|
||||
|
||||
MISTRAL_USER=$(openstack user create \
|
||||
$MISTRAL_ADMIN_USER \
|
||||
--password "$SERVICE_PASSWORD" \
|
||||
--project $SERVICE_TENANT \
|
||||
--email mistral@example.com \
|
||||
| grep " id " | get_field 2)
|
||||
|
||||
openstack role add \
|
||||
$ADMIN_ROLE \
|
||||
--project $SERVICE_TENANT \
|
||||
--user $MISTRAL_USER
|
||||
|
||||
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
|
||||
MISTRAL_SERVICE=$(openstack service create \
|
||||
mistral \
|
||||
--type=workflow_service \
|
||||
--description="Workflow Service" \
|
||||
| grep " id " | get_field 2)
|
||||
openstack endpoint create \
|
||||
$MISTRAL_SERVICE \
|
||||
--region RegionOne \
|
||||
--publicurl "$MISTRAL_SERVICE_PROTOCOL://$MISTRAL_SERVICE_HOST:$MISTRAL_SERVICE_PORT/v1" \
|
||||
--adminurl "$MISTRAL_SERVICE_PROTOCOL://$MISTRAL_SERVICE_HOST:$MISTRAL_SERVICE_PORT/v1" \
|
||||
--internalurl "$MISTRAL_SERVICE_PROTOCOL://$MISTRAL_SERVICE_HOST:$MISTRAL_SERVICE_PORT/v1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function mkdir_chown_stack {
|
||||
if [[ ! -d "$1" ]]; then
|
||||
sudo mkdir -p "$1"
|
||||
fi
|
||||
sudo chown $STACK_USER "$1"
|
||||
}
|
||||
|
||||
# Entry points
|
||||
# ------------
|
||||
|
||||
# configure_mistral() - Set config files, create data dirs, etc
|
||||
function configure_mistral {
|
||||
mkdir_chown_stack "$MISTRAL_CONF_DIR"
|
||||
|
||||
# Copy over Mistral configuration file and configure common parameters.
|
||||
cp $MISTRAL_DIR/etc/mistral.conf.example $MISTRAL_CONF_FILE
|
||||
iniset $MISTRAL_CONF_FILE DEFAULT debug $MISTRAL_DEBUG
|
||||
|
||||
# Run all Mistral processes as a single process
|
||||
iniset $MISTRAL_CONF_FILE DEFAULT server all
|
||||
|
||||
# Mistral Configuration
|
||||
#-------------------------
|
||||
|
||||
# Setup keystone_authtoken section
|
||||
iniset $MISTRAL_CONF_FILE keystone auth_host $KEYSTONE_AUTH_HOST
|
||||
iniset $MISTRAL_CONF_FILE keystone auth_port $KEYSTONE_AUTH_PORT
|
||||
iniset $MISTRAL_CONF_FILE keystone auth_protocol $KEYSTONE_AUTH_PROTOCOL
|
||||
iniset $MISTRAL_CONF_FILE keystone admin_tenant_name $SERVICE_TENANT_NAME
|
||||
iniset $MISTRAL_CONF_FILE keystone admin_user $MISTRAL_ADMIN_USER
|
||||
iniset $MISTRAL_CONF_FILE keystone admin_password $SERVICE_PASSWORD
|
||||
|
||||
# Setup RabbitMQ credentials
|
||||
iniset $MISTRAL_CONF_FILE DEFAULT rabbit_password $RABBIT_PASSWORD
|
||||
|
||||
# Configure the database.
|
||||
iniset $MISTRAL_CONF_FILE database connection `database_connection_url mistral`
|
||||
|
||||
# Configure keystone auth url
|
||||
iniset $MISTRAL_CONF_FILE keystone auth_uri "http://${KEYSTONE_AUTH_HOST}:5000/v3"
|
||||
}
|
||||
|
||||
|
||||
# init_mistral() - Initialize the database
|
||||
function init_mistral() {
|
||||
# (re)create Mistral database
|
||||
recreate_database mistral utf8
|
||||
}
|
||||
|
||||
|
||||
# install_mistral() - Collect source and prepare
|
||||
function install_mistral() {
|
||||
git_clone $MISTRAL_REPO $MISTRAL_DIR $MISTRAL_BRANCH
|
||||
|
||||
# setup_package function is used because Mistral requirements
|
||||
# don't match with global-requirement.txt
|
||||
# both functions (setup_develop and setup_package) are defined at:
|
||||
# http://git.openstack.org/cgit/openstack-dev/devstack/tree/functions-common
|
||||
setup_package $MISTRAL_DIR -e
|
||||
}
|
||||
|
||||
|
||||
# start_mistral() - Start running processes, including screen
|
||||
function start_mistral() {
|
||||
screen_it mistral "cd $MISTRAL_DIR && $MISTRAL_BIN_DIR/mistral-server --config-file $MISTRAL_CONF_DIR/mistral.conf"
|
||||
}
|
||||
|
||||
|
||||
# stop_mistral() - Stop running processes
|
||||
function stop_mistral() {
|
||||
# Kill the Mistral screen windows
|
||||
screen -S $SCREEN_NAME -p mistral -X kill
|
||||
}
|
||||
|
||||
|
||||
# Restore xtrace
|
||||
$XTRACE
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# End:
|
9
tools/check_api.sh
Normal file
9
tools/check_api.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# How many seconds to wait for the API to be responding before giving up
|
||||
API_RESPONDING_TIMEOUT=20
|
||||
|
||||
if ! timeout ${API_RESPONDING_TIMEOUT} sh -c "while ! curl -s http://127.0.0.1:8989/v1/ 2>/dev/null | grep -q 'Authentication required' ; do sleep 1; done"; then
|
||||
echo "Mistral API failed to respond within ${API_RESPONDING_TIMEOUT} seconds"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user