diff --git a/contrib/devstack/README.rst b/contrib/devstack/README.rst index 2185e0aee..453e6288b 100644 --- a/contrib/devstack/README.rst +++ b/contrib/devstack/README.rst @@ -6,6 +6,8 @@ environment variable:: export DEVSTACK_DIR= + 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 diff --git a/contrib/devstack/files/apts/murano b/contrib/devstack/files/apts/murano index 1829850df..9bd6ff597 100644 --- a/contrib/devstack/files/apts/murano +++ b/contrib/devstack/files/apts/murano @@ -1 +1,2 @@ python-mysqldb +zip diff --git a/contrib/devstack/files/rpms/murano b/contrib/devstack/files/rpms/murano new file mode 100644 index 000000000..d0513b233 --- /dev/null +++ b/contrib/devstack/files/rpms/murano @@ -0,0 +1 @@ +zip diff --git a/contrib/devstack/lib/murano b/contrib/devstack/lib/murano index 7c645b16e..de6e2cafe 100644 --- a/contrib/devstack/lib/murano +++ b/contrib/devstack/lib/murano @@ -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 } diff --git a/devstack/README.rst b/devstack/README.rst index 88a606dce..4a8d778dd 100644 --- a/devstack/README.rst +++ b/devstack/README.rst @@ -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 diff --git a/devstack/files/debs/murano b/devstack/files/debs/murano new file mode 100644 index 000000000..d0513b233 --- /dev/null +++ b/devstack/files/debs/murano @@ -0,0 +1 @@ +zip diff --git a/devstack/files/rpms/murano b/devstack/files/rpms/murano new file mode 100644 index 000000000..d0513b233 --- /dev/null +++ b/devstack/files/rpms/murano @@ -0,0 +1 @@ +zip diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 40c3c0d63..ff2f76e86 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -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