Import packages from murano-apps in Devstack

This commit adds a Devstack MURANO_APPS variable which can be used to
install directly from the Git murano-apps repository (repository and
branch customizable) some Murano packages.

E.g MURANO_APPS="io.murano.apps.apache.Tomcat,io.murano.apps.Guacamole"

The murano-apps repository is cloned only if at least one application
is defined in MURANO_APPS.

Implements: blueprint import-apps-devstack
Change-Id: I57f959ddafd62cc726d4f5f80fec27bc86bf05d1
This commit is contained in:
Olivier Lemasle 2015-10-09 23:19:55 +02:00
parent 888b494091
commit 6843856c3d
8 changed files with 116 additions and 1 deletions

View File

@ -6,6 +6,8 @@
environment variable::
export DEVSTACK_DIR=<complete path to devstack directory(clonned)>
cp files/apts/murano ${DEVSTACK_DIR}/files/debs
cp files/rpms/murano ${DEVSTACK_DIR}/files/rpms
cp lib/murano ${DEVSTACK_DIR}/lib
cp lib/murano-dashboard ${DEVSTACK_DIR}/lib
cp extras.d/70-murano.sh ${DEVSTACK_DIR}/extras.d
@ -25,6 +27,19 @@
# Enable Murano
enable_service murano murano-api murano-engine
5. Deploy your OpenStack Cloud with Murano::
5. (Optional) To import Murano packages when DevStack is up, define an ordered
list of packages FQDNs in ``localrc``. Make sure to list all package
dependencies. These packages will by default be imported from the murano-apps
git repository.
Example::
MURANO_APPS=io.murano.apps.apache.Tomcat,io.murano.apps.Guacamole
You can also use the variables ``MURANO_APPS_REPO`` and ``MURANO_APPS_BRANCH``
to configure the git repository which will be used as the source for the
imported packages.
6. Deploy your OpenStack Cloud with Murano::
./stack.sh

View File

@ -1 +1,2 @@
python-mysqldb
zip

View File

@ -0,0 +1 @@
zip

View File

@ -48,6 +48,11 @@ MURANO_DEFAULT_ROUTER=${MURANO_DEFAULT_ROUTER:-''}
MURANO_EXTERNAL_NETWORK=${MURANO_EXTERNAL_NETWORK:-''}
MURANO_DEFAULT_DNS=${MURANO_DEFAULT_DNS:-''}
MURANO_APPS=${MURANO_APPS:-''}
MURANO_APPS_DIR=$DEST/murano-apps
MURANO_APPS_REPO=${MURANO_APPS_REPO:-${GIT_BASE}/openstack/murano-apps.git}
MURANO_APPS_BRANCH=${MURANO_APPS_BRANCH:-master}
# MURANO_RABBIT_VHOST allows to specify a separate virtual host for Murano services.
# This is not required if all OpenStack services are deployed by devstack scripts
# on a single node. In this case '/' virtual host (which is the default) is enough.
@ -208,6 +213,36 @@ function configure_service_broker {
iniset $MURANO_CONF_FILE murano url "http://127.0.0.1:8082"
}
# install_murano_apps() - Install Murano apps from repository murano-apps, if required
function install_murano_apps() {
if [[ -z $MURANO_APPS ]]; then
return
fi
# clone murano-apps only if app installation is required
git_clone $MURANO_APPS_REPO $MURANO_APPS_DIR $MURANO_APPS_BRANCH
# install Murano apps defined in the comma-separated list $MURANO_APPS
for murano_app in ${MURANO_APPS//,/ }; do
find $MURANO_APPS_DIR -type d -name "package" | while read package; do
full_name=$(grep "FullName" "$package/manifest.yaml" | awk -F ':' '{print $2}' | tr -d ' ')
if [[ $full_name = $murano_app ]]; then
pushd $package
zip -r app.zip .
murano --os-username $OS_USERNAME \
--os-password $OS_PASSWORD \
--os-tenant-name $OS_PROJECT_NAME \
--os-auth-url http://$KEYSTONE_AUTH_HOST:5000/v2.0 \
--murano-url http://127.0.0.1:8082 \
package-import \
--is-public \
--exists-action u \
app.zip
popd
fi
done
done
}
# init_murano() - Initialize databases, etc.
function init_murano() {
@ -247,6 +282,12 @@ function install_murano_pythonclient() {
function start_murano() {
screen_it murano-api "cd $MURANO_DIR && $MURANO_BIN_DIR/murano-api --config-file $MURANO_CONF_DIR/murano.conf"
screen_it murano-engine "cd $MURANO_DIR && $MURANO_BIN_DIR/murano-engine --config-file $MURANO_CONF_DIR/murano.conf"
# Give Murano some time to Start
sleep 3
# Install Murano apps, if needed
install_murano_apps
}

View File

@ -18,6 +18,19 @@ Enabling in Devstack
enable_service murano-cfapi
#. (Optional) To import Murano packages when DevStack is up, define an ordered
list of packages FQDNs in ``local.conf``. Make sure to list all package
dependencies. These packages will by default be imported from the murano-apps
git repository.
Example::
MURANO_APPS=io.murano.apps.apache.Tomcat,io.murano.apps.Guacamole
You can also use the variables ``MURANO_APPS_REPO`` and ``MURANO_APPS_BRANCH``
to configure the git repository which will be used as the source for the
imported packages.
#. Install DevStack::
./stack.sh

View File

@ -0,0 +1 @@
zip

View File

@ -0,0 +1 @@
zip

View File

@ -44,6 +44,11 @@ MURANO_DEFAULT_ROUTER=${MURANO_DEFAULT_ROUTER:-''}
MURANO_EXTERNAL_NETWORK=${MURANO_EXTERNAL_NETWORK:-''}
MURANO_DEFAULT_DNS=${MURANO_DEFAULT_DNS:-''}
MURANO_APPS=${MURANO_APPS:-''}
MURANO_APPS_DIR=$DEST/murano-apps
MURANO_APPS_REPO=${MURANO_APPS_REPO:-${GIT_BASE}/openstack/murano-apps.git}
MURANO_APPS_BRANCH=${MURANO_APPS_BRANCH:-master}
# MURANO_RABBIT_VHOST allows to specify a separate virtual host for Murano services.
# This is not required if all OpenStack services are deployed by devstack scripts
# on a single node. In this case '/' virtual host (which is the default) is enough.
@ -195,6 +200,37 @@ function configure_murano {
iniset $MURANO_CONF_FILE murano url "http://127.0.0.1:8082"
}
# install_murano_apps() - Install Murano apps from repository murano-apps, if required
function install_murano_apps() {
if [[ -z $MURANO_APPS ]]; then
return
fi
# clone murano-apps only if app installation is required
git_clone $MURANO_APPS_REPO $MURANO_APPS_DIR $MURANO_APPS_BRANCH
# install Murano apps defined in the comma-separated list $MURANO_APPS
for murano_app in ${MURANO_APPS//,/ }; do
find $MURANO_APPS_DIR -type d -name "package" | while read package; do
full_name=$(grep "FullName" "$package/manifest.yaml" | awk -F ':' '{print $2}' | tr -d ' ')
if [[ $full_name = $murano_app ]]; then
pushd $package
zip -r app.zip .
murano --os-username $OS_USERNAME \
--os-password $OS_PASSWORD \
--os-tenant-name $OS_PROJECT_NAME \
--os-auth-url http://$KEYSTONE_AUTH_HOST:5000/v2.0 \
--murano-url http://127.0.0.1:8082 \
package-import \
--is-public \
--exists-action u \
app.zip
popd
fi
done
done
}
# configure_service_broker() - set service broker specific options to config
function configure_service_broker {
@ -444,6 +480,12 @@ if is_service_enabled murano; then
if is_service_enabled murano-cfapi; then
start_service_broker
fi
# Give Murano some time to Start
sleep 3
# Install Murano apps, if needed
install_murano_apps
fi
if [[ "$1" == "unstack" ]]; then