From 954549a62a7079a9bf8e90d03ece6cfcd33e1215 Mon Sep 17 00:00:00 2001 From: Timur Sufiev Date: Tue, 10 Sep 2013 14:41:58 +0400 Subject: [PATCH] Cherry-pick all changes from release 0.2. * Updated puppet recepies. Iaacba512063811f753a2db768858b22b73f3b9c7 * Updated documentation Id2384b2226a4932963ebc9f6185a9e0cdea869d0 * murano-git-install.sh fix lab-binding.rc file now checked and created before any other operations. I0475e4adeb8c1c568125dce4b773bcf857b8cc3f * Support to use branches not merged yet. Additional action 'upgrade' added. Now 'update' only fetches changes from repo. murano-git-install.sh now can fetch and install from branches that were not merged yet. This should simplify testing and developing. If10e830d46c8af58a26b242b576beaa66f8bc1b6 * Fixed error with 'no branch' in murano-git-install. Log messages updated. I6e56c0bbc0c2b1d997969dc03b0e580f7ec24577 * Checkout of target branch added after clone new repo. python-muranoclient removed from list of installed components. I4afa028e72a1b82bbb81bc92b69ea7c0a62c4d20 * Ability to checkout ref branch added. Iab9a88621283a23063a4c3c558ee3fb31a29514c * murano-git-install updated Additional packages added. Firewall disables. SELinux disabled If9449174eaecc3d4736a3bb13ef4420b01256659 * Murano configuration parameters. 'log_file' and 'auth_url' configuration parameters are updated during install I3af022db21af8a19de6fefed1d2daaeebd558a4c * SSL Support added to murano-git-install script. Addresses blueprint https://blueprints.launchpad.net/murano/+spec/ssl Ib9eb1b8727416a7d67a51277b6493c9e58f7c3bd * Avoiding error message '[: too many arguments' I0253723078f5c3e77debfd8a8138559878544959 * Test expression fixed. Using test statement [...] was wrong for this type of check. Fixes: MRN-903 Ie6640189206084c89f665478d93ef2444afcfd5b * Update script for building documentation Now documentation built not from source checkouted by Jenkins, but checked out explicitly from script. Also we checking out, building and publishing several versions at once. No landing page now exists. Ifbb6d989632ad2277bc1194bd9b440597c916851 * Folder for Murano Getting Started created. README updated, Files to start Vagrant box added, devstack's files added, permissions on local.sh changed, devstack's files updated. I07b2562545e891490bdc6e2d41a804aad8f3ba7f * Fixed compatibility with Sh I077d59f2a864ee8ccace72c35019be17680b8267 * Added feature to build master Ib02ddf2a4c5eefb851a1ce12ce515ef4b813bbc1 * Renamed murano-manual developers-guide I55332c02533c42ce0ece8d89867180daca48b781 * Three occurences of 'bad' character replaced. Fixes: MRN-947 I2f14b97232f0ad772a339cd7d0ebf25e831a76cf * Resolved issues with different guide names for different vers If487a82bd1d68a13577b3c640117f6c737f48885 * Correct pip version now installing by murano-git-install. Bug #1221256 I837ba3af097f7f59123abdd99d9dc7029568ce4d * Fixed list of guides for v0.2 I62240939c742cfc18527b5e79ef578a8bee7224a * Default branch name fixed. Iaac43376f9e3514fe924920035a5a779a303ff11 Also Change default install branch to master. Change-Id: I7bb689f563f6b9806ff1d8dfd4b2161201820798 --- devbox-scripts/murano-git-install.sh | 753 +++++++++++------- docs-builder/builder.sh | 70 +- getting-started/README.rst | 84 ++ getting-started/Vagrantfile | 121 +++ getting-started/lab-binding.rc | 68 ++ getting-started/launch-the-box.sh | 21 + getting-started/local.sh | 146 ++++ getting-started/localrc | 76 ++ getting-started/provision.sh | 40 + .../share/files/ws-2012-core/autounattend.xml | 2 +- .../share/files/ws-2012-std/autounattend.xml | 2 +- image-builder/share/scripts/wpi.ps1 | 2 +- puppet/README.rst | 35 + puppet/puppet_Murano_Conductor.pp | 19 +- puppet/puppet_Murano_Dashboard.pp | 35 + puppet/puppet_Murano_REST_API.pp | 12 +- 16 files changed, 1146 insertions(+), 340 deletions(-) create mode 100644 getting-started/README.rst create mode 100644 getting-started/Vagrantfile create mode 100644 getting-started/lab-binding.rc create mode 100755 getting-started/launch-the-box.sh create mode 100755 getting-started/local.sh create mode 100644 getting-started/localrc create mode 100644 getting-started/provision.sh create mode 100644 puppet/README.rst create mode 100644 puppet/puppet_Murano_Dashboard.pp diff --git a/devbox-scripts/murano-git-install.sh b/devbox-scripts/murano-git-install.sh index 073578f8..5a21761f 100755 --- a/devbox-scripts/murano-git-install.sh +++ b/devbox-scripts/murano-git-install.sh @@ -6,9 +6,15 @@ mode=${1:-'help'} curr_dir=$(cd $(dirname "$0") && pwd) -murano_components="murano-api murano-conductor python-muranoclient murano-dashboard" -murano_services="murano-api murano-conductor" -murano_config_files='/etc/murano-api/murano-api.conf /etc/murano-api/murano-api-paste.ini /etc/murano-conductor/conductor.conf /etc/murano-conductor/conductor-paste.ini' +murano_components='murano-api murano-conductor murano-dashboard' + +murano_services='murano-api murano-conductor' + +murano_config_files='/etc/murano-api/murano-api.conf + /etc/murano-api/murano-api-paste.ini + /etc/murano-conductor/conductor.conf + /etc/murano-conductor/conductor-paste.ini + /usr/share/openstack-dashboard/openstack_dashboard/settings.py' git_prefix="https://github.com/stackforge" @@ -16,31 +22,48 @@ git_clone_root='/opt/git' os_version='' - # Helper funtions #------------------------------------------------- function die { - printf "\n==============================\n" - printf "$@" - printf "\n==============================\n" - exit 1 + printf "\n==============================\n" + printf "$@" + printf "\n==============================\n" + exit 1 } function log { - printf "$@\n" | tee --append /tmp/murano-git-install.log + printf "%s\n" "$@" | tee --append /tmp/murano-git-install.log } function iniset { - local section=$1 - local option=$2 - local value=$3 - local file=$4 + local section=$1 + local option=$2 + local value=$3 + local file=$4 + local line - if [ -z $section ] ; then - sed -i -e "s/^\($option[ \t]*=[ \t]*\).*$/\1$value/" "$file" - else - sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" "$file" - fi + if [ -z "$section" ] ; then + # No section name specified + sed -i -e "s/^\($option[ \t]*=[ \t]*\).*$/\1$value/" "$file" + else + # Check if section already exists + if ! grep -q "^\[$section\]" "$file" ; then + # Add section at the end + echo -e "\n[$section]" >>"$file" + fi + + # Check if parameter in the section exists + line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file") + if [ -z "$line" ] ; then + # Add parameter if it is not exists + sed -i -e "/^\[$section\]/ a\\ +$option = $value +" "$file" + else + # Replace existing parameter + sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" "$file" + fi + fi } #------------------------------------------------- @@ -48,43 +71,350 @@ function iniset { # Workflow functions #------------------------------------------------- function install_prerequisites { - case $os_version in - 'CentOS') - log "** Installing additional software sources ..." - yum install -y 'http://rdo.fedorapeople.org/openstack/openstack-grizzly/rdo-release-grizzly.rpm' - yum install -y 'http://mirror.yandex.ru/epel/6/x86_64/epel-release-6-8.noarch.rpm' + case $os_version in + 'CentOS') + log "** Installing additional software sources ..." + yum install -y 'http://rdo.fedorapeople.org/openstack/openstack-grizzly/rdo-release-grizzly.rpm' + yum install -y 'http://mirror.yandex.ru/epel/6/x86_64/epel-release-6-8.noarch.rpm' - log "** Updating system ..." - yum update -y + log "** Updating system ..." + yum update -y - log "** Installing OpenStack dashboard ..." - yum install make gcc python-netaddr.noarch python-keystoneclient.noarch python-django-horizon.noarch python-django-openstack-auth.noarch httpd.x86_64 mod_wsgi.x86_64 openstack-dashboard.noarch --assumeyes - ;; - 'Ubuntu') - log "** Installing additional software sources ..." - echo 'deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main' > /etc/apt/sources.list.d/grizzly.list - apt-get install -y ubuntu-cloud-keyring - - log "** Updating system ..." - apt-get update -y - apt-get upgrade -y + log "** Upgrading pip ..." + pip install --upgrade pip + #rm /usr/bin/pip + #ln -s /usr/local/bin/pip /usr/bin/pip - log "** Installing OpenStack dashboard ..." - apt-get install -y memcached libapache2-mod-wsgi openstack-dashboard + log "** Installing OpenStack dashboard ..." + yum install make gcc python-netaddr.noarch python-keystoneclient.noarch python-django-horizon.noarch python-django-openstack-auth.noarch httpd.x86_64 mod_wsgi.x86_64 openstack-dashboard.noarch --assumeyes - log "** Removing Ubuntu Dashboard Theme ..." - dpkg --purge openstack-dashboard-ubuntu-theme + log "** Disabling firewall ..." + service iptables stop + chkconfig iptables off - log "** Restarting Apache server ..." - service apache2 restart - ;; - esac + log "** Disabling SELinux ..." + setenforce permissive + iniset '' 'SELINUX' 'permissive' '/etc/selinux/config' + ;; + 'Ubuntu') + log "** Installing additional software sources ..." + echo 'deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main' > /etc/apt/sources.list.d/grizzly.list + apt-get install -y ubuntu-cloud-keyring - log "** Creating lab-binding.rc file" - if [ ! -f '/etc/murano-deployment/lab-binding.rc' ] ; then - mkdir '/etc/murano-deployment' + log "** Updating system ..." + apt-get update -y + apt-get upgrade -y - cat << "EOF" > /etc/murano-deployment/lab-binding.rc + log "** Installing additional packages ..." + apt-get install -y node-less python-pip + + log "** Upgrading pip ..." + pip install --upgrade pip + rm /usr/bin/pip + ln -s /usr/local/bin/pip /usr/bin/pip + + log "** Installing OpenStack dashboard ..." + apt-get install -y memcached libapache2-mod-wsgi openstack-dashboard + + log "** Removing Ubuntu Dashboard Theme ..." + dpkg --purge openstack-dashboard-ubuntu-theme + + log "** Restarting Apache server ..." + service apache2 restart + ;; + esac +} + + +function fetch_murano_apps { + RETURN='' + + for app_name in $murano_components ; do + log '' + log '' + log "*** Working with '$app_name'" + + git_repo="$git_prefix/$app_name.git" + git_clone_dir="$git_clone_root/$app_name" + + case $app_name in + 'murano-api') + REMOTE_BRANCH=${BRANCH_MURANO_API:-$BRANCH_NAME} + ;; + 'murano-conductor') + REMOTE_BRANCH=${BRANCH_MURANO_CONDUCTOR:-$BRANCH_NAME} + ;; + 'python-muranoclient') + REMOTE_BRANCH=${BRANCH_MURANO_CLIENT:-$BRANCH_NAME} + ;; + 'murano-dashboard') + REMOTE_BRANCH=${BRANCH_MURANO_DASHBOARD:-$BRANCH_NAME} + ;; + *) + REMOTE_BRANCH=$BRANCH_NAME + ;; + esac + + local do_checkout='' + if [ -d "$git_clone_dir" ] ; then + cd "$git_clone_dir" + git reset --hard + git clean -fd + git remote update || die "'git remote update' failed for '$git_repo'" + + rev_on_local=$(git rev-list --max-count=1 HEAD) + if [[ "$REMOTE_BRANCH" =~ ^refs ]] ; then + git fetch "$git_repo" "$REMOTE_BRANCH" + rev_on_origin=$(git rev-list --max-count=1 FETCH_HEAD) + else + rev_on_origin=$(git rev-list --max-count=1 origin/$REMOTE_BRANCH) + fi + + log "* Revision on local = $rev_on_local" + log "* Revision on origin = $rev_on_origin" + + if [[ "$rev_on_local" != "$rev_on_origin" ]] ; then + do_checkout=$app_name + fi + else + git clone $git_repo $git_clone_dir || die "Unable to clone repository '$git_repo'" + cd "$git_clone_dir" + do_checkout=$app_name + fi + + if [ -z $do_checkout ] ; then + log "* '$app_name' is up-to-date." + log "----- ----- ----- ----- -----" + log "(git status):" + git status + log "***** ***** ***** ***** *****" + log "(git log -1):" + git log -1 + log "===== ===== ===== ===== =====" + else + if [[ "$REMOTE_BRANCH" =~ ^refs ]] ; then + git fetch "$git_repo" "$REMOTE_BRANCH" && git checkout FETCH_HEAD + else + if [ -n "$(git branch | grep $REMOTE_BRANCH)" ] ; then + log "* branch '$REMOTE_BRANCH' found locally, updating ..." + git checkout $REMOTE_BRANCH + else + log "* branch '$REMOTE_BRANCH' not found locally, fetching ..." + git checkout -b $REMOTE_BRANCH origin/$REMOTE_BRANCH + fi + git pull + fi + + log "* Switched to '$REMOTE_BRANCH':" + log "----- ----- ----- ----- -----" + log "(git log -1):" + git log -1 + log "===== ===== ===== ===== =====" + + RETURN="$RETURN $app_name" + fi + done +} + + +function install_murano_apps { + local apps_list="$@" + + log "** Installing Murano components '$apps_list'..." + for app_name in $apps_list ; do + log "** Installing '$app_name' ..." + + git_clone_dir="$git_clone_root/$app_name" + chmod +x $git_clone_dir/setup*.sh + + case $os_version in + 'CentOS') + "$git_clone_dir"/setup-centos.sh install + ;; + 'Ubuntu') + "$git_clone_dir"/setup.sh install + ;; + esac + + done +} + + +function uninstall_murano_apps { + local apps_list="$@" + + log "** Uninstalling Murano components '$apps_list'..." + for app_name in $apps_list ; do + log "** Uninstalling '$app_name' ..." + + git_clone_dir="$git_clone_root/$app_name" + chmod +x $git_clone_dir/setup*.sh + + case $os_version in + 'CentOS') + "$git_clone_dir"/setup-centos.sh uninstall + ;; + 'Ubuntu') + "$git_clone_dir"/setup.sh uninstall + ;; + esac + + case $app_name in + 'murano-api') + rm -rf /etc/$app_name + ;; + 'murano-conductor') + rm -rf /etc/$app_name + ;; + esac + done +} + + +function configure_murano { + log "** Configuring Murano ..." + + for config_file in $murano_config_files ; do + log "** Configuring file '$config_file'" + + if [ ! -f "$config_file" ] ; then + cp "$config_file.sample" "$config_file" + fi + + case "$config_file" in + '/etc/murano-api/murano-api.conf') + iniset 'DEFAULT' 'log_file' '/var/log/murano-api.log' "$config_file" + iniset 'rabbitmq' 'host' "$LAB_HOST" "$config_file" + iniset 'rabbitmq' 'login' "$RABBITMQ_LOGIN" "$config_file" + iniset 'rabbitmq' 'password' "$RABBITMQ_PASSWORD" "$config_file" + iniset 'rabbitmq' 'virtual_host' "$RABBITMQ_VHOST" "$config_file" + ;; + '/etc/murano-api/murano-api-paste.ini') + sed -i -e "s/^\(\[pipeline:\)api.py/\1murano-api/" "$config_file" # Ugly workaround + iniset 'filter:authtoken' 'auth_host' "$LAB_HOST" "$config_file" + iniset 'filter:authtoken' 'admin_user' "$ADMIN_USER" "$config_file" + iniset 'filter:authtoken' 'admin_password' "$ADMIN_PASSWORD" "$config_file" + ;; + '/etc/murano-conductor/conductor.conf') + iniset 'DEFAULT' 'log_file' '/var/log/murano-conductor.log' "$config_file" + iniset 'keystone' 'auth_url' "$AUTH_URL" "$config_file" + iniset 'rabbitmq' 'host' "$LAB_HOST" "$config_file" + iniset 'rabbitmq' 'login' "$RABBITMQ_LOGIN" "$config_file" + iniset 'rabbitmq' 'password' "$RABBITMQ_PASSWORD" "$config_file" + iniset 'rabbitmq' 'virtual_host' "$RABBITMQ_VHOST" "$config_file" + ;; + '/etc/openstack-dashboard/local_settings') + iniset '' 'OPENSTACK_HOST' "'$LAB_HOST'" "$config_file" + ;; + '/etc/openstack-dashboard/local_settings.py') + iniset '' 'OPENSTACK_HOST' "'$LAB_HOST'" "$config_file" + ;; + esac + + if [ "$SSL_ENABLED" = 'true' ] ; then + case "$config_file" in + '/etc/murano-api/murano-api.conf') + iniset 'ssl' 'cert_file' '/etc/murano-api/server.crt' "$config_file" + iniset 'ssl' 'key_file' '/etc/murano-api/server.key' "$config_file" + ;; + '/etc/murano-api/murano-api-paste.ini') + iniset 'filter:authtoken' 'auth_protocol' 'https' "$config_file" + ;; + '/etc/murano-conductor/conductor.conf') + iniset 'keystone' 'insecure' 'True' "$config_file" + iniset 'heat' 'insecure' 'True' "$config_file" + ;; + '/usr/share/openstack-dashboard/openstack_dashboard/settings.py') + echo '' >> "$config_file" + echo "MURANO_API_INSECURE = True" >> "$config_file" + echo "MURANO_API_URL = 'https://localhost:8082'" >> "$config_file" + ;; + esac + fi + done +} + + +function restart_murano { + for service_name in $murano_services ; do + log "** Restarting '$service_name'" + stop "$service_name" + start "$service_name" + done + + log "** Restarting 'Apache'" + case $os_version in + 'CentOS') + service httpd restart + ;; + 'Ubuntu') + service apache2 restart + ;; + esac +} +#------------------------------------------------- + + +if [[ $mode =~ '?'|'help'|'-h'|'--help' ]] ; then + cat << EOF + +The following options are awailable: + * help - show help. This is a default action. + * prerequisites - install prerequisites for Murano (OpenStack dashboard and other packages) + * install - install and configure Murano components. Please be sure that you have prerequisites installed first. + * reinstall - unisntall and then install all Murano components. + * uninstall - uninstall Murano components. + * update - fetch changes and reinstall components changed. + * configure - configure Murano components. + * restart - restart Murano components and Apache server + +EOF + exit +fi + + +mkdir -p $git_clone_root + +if [ -f /etc/redhat-release ] ; then + os_version=$(cat /etc/redhat-release | cut -d ' ' -f 1) +fi + +if [ -f /etc/lsb-release ] ; then + os_version=$(cat /etc/lsb-release | grep DISTRIB_ID | cut -d '=' -f 2) +fi + +if [ -z $os_version ] ; then + die "Unable to determine OS version. Exiting." +else + log "* OS version is '$os_version'" +fi + + +case $os_version in + 'CentOS') + murano_config_files="$murano_config_files /etc/openstack-dashboard/local_settings" + ;; + 'Ubuntu') + murano_config_files="$murano_config_files /etc/openstack-dashboard/local_settings.py" + ;; +esac + + +configuration_required='' +for config_file in $murano_config_files ; do + if [ ! -f "$config_file" ] ; then + log "! Required config file '$config_file' not exists. Murano should be configured before start." + configuration_required="$configuration_required $config_file" + fi +done + + +devbox_config='/etc/murano-deployment/lab-binding.rc' + +if [ ! -f "$devbox_config" ] ; then + mkdir '/etc/murano-deployment' + + cat << "EOF" > $devbox_config # Vi / Vim notes # * Press 'i' to enter INSERT mode # * Edit the file @@ -102,281 +432,92 @@ RABBITMQ_PASSWORD='' RABBITMQ_VHOST='' BRANCH_NAME='master' + +# Only 'true' or 'false' values are allowed! +SSL_ENABLED='false' + +#BRANCH_MURANO_API='' +#BRANCH_MURANO_DASHBOARD='' +#BRANCH_MURANO_CLIENT='' +#BRANCH_MURANO_CONDUCTOR='' EOF - fi - log "***** ***** ***** ***** *****" - log "Now you should configure lab binding settings in" - log " /etc/murano-deployment/lab-binding.rc" - log "***** ***** ***** ***** *****" + log "***** ***** ***** ***** *****" + log "Now you should configure lab binding settings in" + log " $devbox_config" + log "***** ***** ***** ***** *****" - printf '\n\n' - read -p "Press to start editing the file in 'vi' (you have no choice) ... " + printf '\n\n' + read -p "Press to start editing the file in 'vi' ... " - if [ -f '/etc/murano-deployment/lab-binding.rc' ] ; then - vi '/etc/murano-deployment/lab-binding.rc' - fi -} - - -function fetch_murano_apps { - RETURN='' - - for app_name in $murano_components ; do - log "* Working with '$app_name'" - - git_repo="$git_prefix/$app_name.git" - git_clone_dir="$git_clone_root/$app_name" - - if [ ! -d "$git_clone_dir" ] ; then - git clone $git_repo $git_clone_dir || die "Unable to clone repository '$git_repo'" - RETURN="$RETURN $app_name" - else - cd "$git_clone_dir" - git reset --hard - git clean -fd - git remote update - git checkout origin/$BRANCH_NAME - - rev_on_local=$(git rev-list --max-count=1 $BRANCH_NAME) - rev_on_origin=$(git rev-list --max-count=1 origin/$BRANCH_NAME) - - if [ "$rev_on_local" == "$rev_on_origin" ] ; then - log "\n'$app_name' is up-to-date." - log "***** ***** ***** ***** *****" - git status - log "***** ***** ***** ***** *****" - else - git pull origin $BRANCH_NAME - RETURN="$RETURN $app_name" - fi - fi - done -} - - -function install_murano_apps { - local apps_list="$@" - - log "** Installing Murano components '$apps_list'..." - for app_name in $apps_list ; do - log "** Installing '$app_name' ..." - - git_clone_dir="$git_clone_root/$app_name" - chmod +x $git_clone_dir/setup*.sh - - case $os_version in - 'CentOS') - "$git_clone_dir"/setup-centos.sh install - ;; - 'Ubuntu') - "$git_clone_dir"/setup.sh install - ;; - esac - - done -} - - -function uninstall_murano_apps { - local apps_list="$@" - - log "** Uninstalling Murano components '$apps_list'..." - for app_name in $apps_list ; do - log "** Uninstalling '$app_name' ..." - - git_clone_dir="$git_clone_root/$app_name" - chmod +x $git_clone_dir/setup*.sh - - case $os_version in - 'CentOS') - "$git_clone_dir"/setup-centos.sh uninstall - ;; - 'Ubuntu') - "$git_clone_dir"/setup.sh uninstall - ;; - esac - - case $app_name in - 'murano-api') - rm -rf /etc/$app_name - ;; - 'murano-conductor') - rm -rf /etc/$app_name - ;; - esac - done -} - - -function configure_murano { - log "** Configuring Murano ..." - - for config_file in $murano_config_files ; do - log "** Configuring file '$config_file'" - - if [ ! -f "$config_file" ] ; then - cp "$config_file.sample" "$config_file" - fi - - case "$config_file" in - '/etc/murano-api/murano-api.conf') - iniset 'rabbitmq' 'host' "$LAB_HOST" "$config_file" - iniset 'rabbitmq' 'login' "$RABBITMQ_LOGIN" "$config_file" - iniset 'rabbitmq' 'password' "$RABBITMQ_PASSWORD" "$config_file" - iniset 'rabbitmq' 'virtual_host' "$RABBITMQ_VHOST" "$config_file" - ;; - '/etc/murano-api/murano-api-paste.ini') - sed -i -e "s/^\(\[pipeline:\)api.py/\1murano-api/" "$config_file" # Ugly workaround - iniset 'filter:authtoken' 'auth_host' "$LAB_HOST" "$config_file" - iniset 'filter:authtoken' 'admin_user' "$ADMIN_USER" "$config_file" - iniset 'filter:authtoken' 'admin_password' "$ADMIN_PASSWORD" "$config_file" - ;; - '/etc/murano-conductor/conductor.conf') - iniset 'heat' 'auth_url' "$AUTH_URL" "$config_file" - iniset 'rabbitmq' 'host' "$LAB_HOST" "$config_file" - iniset 'rabbitmq' 'login' "$RABBITMQ_LOGIN" "$config_file" - iniset 'rabbitmq' 'password' "$RABBITMQ_PASSWORD" "$config_file" - iniset 'rabbitmq' 'virtual_host' "$RABBITMQ_VHOST" "$config_file" - ;; - '/etc/openstack-dashboard/local_settings') - iniset '' 'OPENSTACK_HOST' "'$LAB_HOST'" "$config_file" - ;; - '/etc/openstack-dashboard/local_settings.py') - iniset '' 'OPENSTACK_HOST' "'$LAB_HOST'" "$config_file" - ;; - esac - done -} - - -function restart_murano { - for service_name in $murano_services ; do - log "** Restarting '$service_name'" - stop "$service_name" - start "$service_name" - done - - log "** Restarting 'Apache'" - case $os_version in - 'CentOS') - service httpd restart - ;; - 'Ubuntu') - service apache2 restart - ;; - esac -} -#------------------------------------------------- - - -if [[ $mode =~ '?'|'help'|'-h'|'--help' ]] ; then - cat << EOF - -The following options are awailable: - * help - show help. This is a default action. - * prerequisites - install prerequisites for Murano (OpenStack dashboard and other packages) - * install - install and configure Murano components. Please be sure that you have prerequisites installed first. - * reinstall - unisntall and then install all Murano components. - * uninstall - uninstall Murano components. - * update - fetch changes and reinstall components changed. - * configure - configure Murano components. - * restart - restart Murano components and Apache server - -EOF - exit + if [ -f "$devbox_config" ] ; then + vi "$devbox_config" + fi fi - -mkdir -p $git_clone_root - -if [ -f /etc/redhat-release ] ; then - os_version=$(cat /etc/redhat-release | cut -d ' ' -f 1) +if [ ! -f "$devbox_config" ] ; then + die "Configuration file '$devbox_config' not found." fi -if [ -f /etc/lsb-release ] ; then - os_version=$(cat /etc/lsb-release | grep DISTRIB_ID | cut -d '=' -f 2) -fi +source "$devbox_config" -if [ -z $os_version ] ; then - die "Unable to determine OS version. Exiting." -else - log "* OS version is '$os_version'" -fi - - -case $os_version in - 'CentOS') - murano_config_files="$murano_config_files /etc/openstack-dashboard/local_settings" - ;; - 'Ubuntu') - murano_config_files="$murano_config_files /etc/openstack-dashboard/local_settings.py" - ;; -esac - - -configuration_required='' -for config_file in $murano_config_files ; do - if [ ! -f "$config_file" ] ; then - log "! Required config file '$config_file' not exists. Murano should be configured before start." - configuration_required="$configuration_required $config_file" - fi -done - - -if [ ! -f '/etc/murano-deployment/lab-binding.rc' ] ; then - die "Configuration file '/etc/murano-dashboard/lab-binding.rc' not found." -fi - -source /etc/murano-deployment/lab-binding.rc +SSL_ENABLED=${SSL_ENABLED:-'false'} log "* Running mode '$mode'" case $mode in - 'fetch') - fetch_murano_apps - ;; - 'install') - fetch_murano_apps + 'fetch') + fetch_murano_apps + ;; + 'install') + fetch_murano_apps - install_murano_apps $murano_components - configure_murano + install_murano_apps $murano_components + configure_murano - restart_murano - ;; - 'reinstall') - fetch_murano_apps - - uninstall_murano_apps $murano_components - install_murano_apps $murano_components + restart_murano + ;; + 'reinstall') + fetch_murano_apps - configure_murano + uninstall_murano_apps $murano_components + install_murano_apps $murano_components - restart_murano - ;; - 'uninstall') - uninstall_murano_apps $murano_components - ;; - 'configure') - configure_murano + configure_murano - restart_murano - ;; - 'prerequisites') - install_prerequisites - ;; - 'update') - fetch_murano_apps - apps_list=$RETURN - - if [ -n "$apps_list" ] ; then - uninstall_murano_apps $apps_list - install_murano_apps $apps_list + restart_murano + ;; + 'uninstall') + uninstall_murano_apps $murano_components + ;; + 'configure') + configure_murano - restart_murano - fi - ;; - 'restart') - restart_murano - ;; + restart_murano + ;; + 'prerequisites') + install_prerequisites + ;; + 'update') + fetch_murano_apps + log '' + log "List of updated apps:" + log "***** ***** ***** ***** *****" + log $RETURN + log "***** ***** ***** ***** *****" + ;; + 'upgrade') + fetch_murano_apps + apps_list=$RETURN + + if [ -n "$apps_list" ] ; then + uninstall_murano_apps $apps_list + install_murano_apps $apps_list + + restart_murano + fi + ;; + 'restart') + restart_murano + ;; esac diff --git a/docs-builder/builder.sh b/docs-builder/builder.sh index 1518694e..a98fbd1f 100755 --- a/docs-builder/builder.sh +++ b/docs-builder/builder.sh @@ -1,42 +1,68 @@ #!/bin/sh -x +# Copyright (c) 2013 Mirantis, Inc. # +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. -cd ~/tests +#create temp directory where we going to work +TEMP=$PWD/temp-$(date +%s) +mkdir "${TEMP}" #clone and clean github pages -rm -rf murano-docs +cd "${TEMP}" git clone git@github.com:murano-docs/murano-docs.github.io.git murano-docs cd murano-docs ls -A1 | grep -v -e '\.git' | xargs git rm -rf -cd ~/tests -#copy site -cp -r $WORKSPACE/site/* ~/tests/murano-docs/ +for version in "0.1" "0.2" "latest" +do + cd "${TEMP}" -#generate murano-manual -cd $WORKSPACE/src/murano-manual -mvn clean generate-sources + if [ ${version} = "latest" ]; then + guides="murano-manual murano-deployment-guide" + branch="master" + elif [ ${version} = "0.2" ]; then + guides="developers-guide administrators-guide user-guide" + branch="release-${version}" + elif [ ${version} = "0.1" ]; then + guides="murano-manual murano-deployment-guide" + branch="release-${version}" + else + guides="developers-guide murano-deployment-guide" + branch="release-${version}" + fi -#copy murano-manual -mkdir -p ~/tests/murano-docs/docs/murano-manual -cp -r target/docbkx/webhelp/murano-manual/* ~/tests/murano-docs/docs/murano-manual -cp target/docbkx/pdf/murano-manual.pdf ~/tests/murano-docs/docs/murano-manual -cd ~/tests + git clone -b ${branch} git@github.com:stackforge/murano-docs.git docs-${version} + cd docs-${version} && git pull && cd .. -#generate murano-deployment-guide -cd $WORKSPACE/src/murano-deployment-guide -mvn clean generate-sources + for guide in ${guides} + do + cd "${TEMP}/docs-${version}/src/${guide}" + mvn clean generate-sources -#copy murano-deployment-guide -mkdir -p ~/tests/murano-docs/docs/murano-deployment-guide -cp -r target/docbkx/webhelp/murano-deployment-guide/* ~/tests/murano-docs/docs/murano-deployment-guide -cp -r target/docbkx/pdf/murano-deployment-guide.pdf ~/tests/murano-docs/docs/murano-deployment-guide -cd ~/tests + built_manual=${TEMP}/murano-docs/${version}/${guide} + mkdir -p "${built_manual}" + cp -r "target/docbkx/webhelp/${guide}"/* "${built_manual}" + cp "target/docbkx/pdf/${guide}.pdf" "${built_manual}" + done +done #commit generated data -cd ~/tests/murano-docs +cd "${TEMP}/murano-docs" git config user.email "murano-eng@mirantis.com" git config user.name "murano-docs" git add . git commit -am "generated `date`." git push origin master + +#clean-up +rm -rf "${TEMP}" \ No newline at end of file diff --git a/getting-started/README.rst b/getting-started/README.rst new file mode 100644 index 00000000..4b313381 --- /dev/null +++ b/getting-started/README.rst @@ -0,0 +1,84 @@ +Murano Getting Started +====================== + +This folder contains files mentioned in Murano Getting Started guide. + +Murano Vagrant Box +================== + +This repo contains a few files that are required to build a Murano Devbox using Vagrant. + +Required step are quite simple: + +Prepare Environment +------------------- + +Ubuntu +------ + +- Install *VirtualBox*: + +:: + + apt-get install virtualbox + + +- Install *VirtualBox Extension Pack*. You can find the appropriate version in [VirtualBox Downloads](https://www.virtualbox.org/wiki/Downloads) + +- Install *Vagrant*: + +:: + + apt-get install vagrant --no-install-recommends + + +- Upgrade *Vagrant*: + + - download latest Vagrant package from [official download site](http://downloads.vagrantup.com/). Example below uses version 1.2.7 for x64 .deb system: + +:: + + wget http://files.vagrantup.com/packages/7ec0ee1d00a916f80b109a298bab08e391945243/vagrant_1.2.7_x86_64.deb + + + - upgrade the existsing installation: + +:: + + dpkg --install vagrant_1.2.7_x86_64.deb + + +Launch The Box +-------------- + +- This repository is already fetched somewhere on your machine, I suppose. If not - please clone it now. + +- Change directory to cloned repository folder. + +- **IMPORTANT STEP:** Edit the *lab-binding.rc* file. + +- Launch the box: + +:: + + ./launch-the-box.sh + + +- The script will do the following: + + - Download the box. + - Add the box into vagrant. + +- Vagrant will do the rest: + + - Start the box. + - Download and install *Murano* components. + +- When everything is done open the [http://127.0.0.1:8080/horizon](http://127.0.0.1:8080/horizon) link. + + + +SEE ALSO +======== +* `Murano `__ + diff --git a/getting-started/Vagrantfile b/getting-started/Vagrantfile new file mode 100644 index 00000000..bb25568d --- /dev/null +++ b/getting-started/Vagrantfile @@ -0,0 +1,121 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # All Vagrant configuration is done here. The most common configuration + # options are documented and commented below. For a complete reference, + # please see the online documentation at vagrantup.com. + + # Every Vagrant virtual environment requires a box to build off of. + config.vm.box = "precise64" + + # The url from where the 'config.vm.box' box will be fetched if it + # doesn't already exist on the user's system. + config.vm.box_url = "https://www.dropbox.com/sh/f8w9xsowbr7rglj/uHiFONsUKO/precise64.box" + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # config.vm.network :forwarded_port, guest: 80, host: 8080 + config.vm.network :forwarded_port, guest: 80, host: 8080 + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network :private_network, ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network :public_network + + # If true, then any SSH connections made will enable agent forwarding. + # Default value: false + # config.ssh.forward_agent = true + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "../data", "/vagrant_data" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider :virtualbox do |vb| + # # Don't boot with headless mode + # vb.gui = true + # + # # Use VBoxManage to customize the VM. For example to change memory: + # vb.customize ["modifyvm", :id, "--memory", "1024"] + # end + # + # View the documentation for the provider you're using for more + # information on available options. + + # Enable provisioning with Puppet stand alone. Puppet manifests + # are contained in a directory path relative to this Vagrantfile. + # You will need to create the manifests directory and a manifest in + # the file base.pp in the manifests_path directory. + # + # An example Puppet manifest to provision the message of the day: + # + # # group { "puppet": + # # ensure => "present", + # # } + # # + # # File { owner => 0, group => 0, mode => 0644 } + # # + # # file { '/etc/motd': + # # content => "Welcome to your Vagrant-built virtual machine! + # # Managed by Puppet.\n" + # # } + # + # config.vm.provision :puppet do |puppet| + # puppet.manifests_path = "manifests" + # puppet.manifest_file = "init.pp" + # end + + # Enable provisioning with chef solo, specifying a cookbooks path, roles + # path, and data_bags path (all relative to this Vagrantfile), and adding + # some recipes and/or roles. + # + # config.vm.provision :chef_solo do |chef| + # chef.cookbooks_path = "../my-recipes/cookbooks" + # chef.roles_path = "../my-recipes/roles" + # chef.data_bags_path = "../my-recipes/data_bags" + # chef.add_recipe "mysql" + # chef.add_role "web" + # + # # You may also specify custom JSON attributes: + # chef.json = { :mysql_password => "foo" } + # end + + # Enable provisioning with chef server, specifying the chef server URL, + # and the path to the validation key (relative to this Vagrantfile). + # + # The Opscode Platform uses HTTPS. Substitute your organization for + # ORGNAME in the URL and validation key. + # + # If you have your own Chef Server, use the appropriate URL, which may be + # HTTP instead of HTTPS depending on your configuration. Also change the + # validation key to validation.pem. + # + # config.vm.provision :chef_client do |chef| + # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" + # chef.validation_key_path = "ORGNAME-validator.pem" + # end + # + # If you're using the Opscode platform, your validator client is + # ORGNAME-validator, replacing ORGNAME with your organization name. + # + # If you have your own Chef Server, the default validation client name is + # chef-validator, unless you changed the configuration. + # + # chef.validation_client_name = "ORGNAME-validator" + + config.vm.provision :shell, :path => "provision.sh" +end diff --git a/getting-started/lab-binding.rc b/getting-started/lab-binding.rc new file mode 100644 index 00000000..68c543dc --- /dev/null +++ b/getting-started/lab-binding.rc @@ -0,0 +1,68 @@ +# +# Insert your values instead of '***' marks anywhere in the config below. +# + + +# Lab Settings +#------------- +# Address of the host which provides Keystone service. +# +# LAB_HOST='172.18.124.201' +LAB_HOST='***.***.***.***' + +# An OpenStack Admin user. +# +# ADMIN_USER='admin' +ADMIN_USER='admin' + +# A password for OpenStack admin user. +# +# ADMIN_PASSWORD='' +ADMIN_PASSWORD='***' +#------------- + + +# RabbitMQ Settings +#------------------ +# A user which has permissions to connect to RabbitMQ vHost specified below. +# NOTE: For now, this user MUST have an 'Administrator' tag +# +# RABBITMQ_USER='muranouser' +RABBITMQ_USER='muranouser' + +# A password for RabbitMQ user +# +# RABBITMQ_PASSWORD='murano' +RABBITMQ_PASSWORD='***' + +# A vHost for current devbox. +# NOTE: It's a good practice to create new vHost dedicated to only one devbox. +# This prevents name collisions and message stealing. +# +# RABBITMQ_VHOST='muranovhost' +RABBITMQ_VHOST='***' +#------------------ + + +# Murano Components Branch +#------------------------- +# Default branch name for all Murano components +# +BRANCH_NAME='master' + +# NOTE: Any Murano component can be checked out from its own branch. +# This is useful for testing purposes. +# Per-components branch variables are shown below. +# Their names are self-explanatory. +# +#BRANCH_MURANO_API='master' +#BRANCH_MURANO_CONDUCTOR='master' +#BRANCH_MURANO_DASHBOARD='master' + +#------------------------- + + +# DO NOT MODIFY ANYTHING BELOW THIS LINE +#======================================= + +AUTH_URL="http://$LAB_HOST:5000/v2.0" diff --git a/getting-started/launch-the-box.sh b/getting-started/launch-the-box.sh new file mode 100755 index 00000000..8f62a984 --- /dev/null +++ b/getting-started/launch-the-box.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +box_name='precise64' +box_url='https://www.dropbox.com/sh/f8w9xsowbr7rglj/uHiFONsUKO/precise64.box' + +if [ -f "$box_name.box" ] ; then + echo "*** Box file found in current directory. Skipping download." +else + echo "*** Downloading box '$box_name' from '$box_url' ..." + wget $box_url -O $box_name.box +fi + +echo "*** Adding the box to vagrant ..." +vagrant box add $box_name $box_name.box + +echo "*** Running vagrant ..." +vagrant up +# VAGRANT_LOG=debug is a workaround for the bug +# https://github.com/mitchellh/vagrant/issues/516 + +echo "*** Now you can open the link 'http://127.0.0.1:8080' in your browser." diff --git a/getting-started/local.sh b/getting-started/local.sh new file mode 100755 index 00000000..b4b46801 --- /dev/null +++ b/getting-started/local.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# Copyright (c) 2013 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Ubuntu script. + +# Keep track of the devstack directory +TOP_DIR=$(cd $(dirname "$0") && pwd) + +# Import common functions +source $TOP_DIR/functions + +# Use openrc + stackrc + localrc for settings +source $TOP_DIR/stackrc + +# Destination path for installation ``DEST`` +DEST=${DEST:-/opt/stack} +source $TOP_DIR/localrc + +# Get OpenStack admin auth +source $TOP_DIR/openrc admin admin + +# set rabbitMQ murano credentials +RABBIT_USER=${RABBIT_USER:-muranouser} +RABBIT_PASSWD=${RABBIT_PASSWD:-murano} +RABBIT_VHOST=${RABBIT_VHOST:-muranovhost} +RABBIT_WWW_ENABLED=${RABBIT_WWW_ENABLED:-True} + + +# Functions + +# Enable web management for rabbitMQ +function enable_rabbit_www { + # Check that RABBIT_SBIN value right and exists !!! + RABBIT_SBIN=/usr/lib/rabbitmq/lib/rabbitmq_server-2.7.1/sbin + if [[ -z "$(sudo $RABBIT_SBIN/rabbitmq-plugins list -e | grep rabbitmq_management)" ]] ; then + echo " * Enabling RabbitMQ management plugin" + sudo $RABBIT_SBIN/rabbitmq-plugins enable rabbitmq_management + echo " * Restarting RabbitMQ ..." + restart_service rabbitmq-server + else + echo " * RabbitMQ management plugin already enabled." + fi +} + +# Add murano credentials to rabbitMQ +function configure_rabbitmq { + echo " * Setting up RabbitMQ..." + # wait until service brings up and start responding + MAX_RETR=6 + SLEEP=10 + FAIL=1 + echo " * Waiting for rabbitMQ service ..." + for _seq in $(seq $MAX_RETR) + do + sudo rabbitmqctl status + if [ $? -ne 0 ]; then + sleep $SLEEP + else + if [[ "$RABBIT_WWW_ENABLED" = "True" ]]; then + enable_rabbit_www + fi + sleep 5 + if [[ -z "$(sudo rabbitmqctl list_users | grep murano)" ]]; then + echo " * Adding user account settings for \"$RABBIT_USER\" ..." + sudo rabbitmqctl add_user $RABBIT_USER $RABBIT_PASSWD + sudo rabbitmqctl set_user_tags $RABBIT_USER administrator + sudo rabbitmqctl add_vhost $RABBIT_VHOST + sudo rabbitmqctl set_permissions -p $RABBIT_VHOST $RABBIT_USER ".*" ".*" ".*" + else + echo " * User \"$RABBIT_USER\" already exists." + fi + FAIL=0 + break + fi + done + if [ $FAIL -ne 0 ]; then + echo << "EOF" +Something goes wrong with rabbitMQ, try run next lines manualy: +sudo rabbitmqctl add_user $RABBIT_USER $RABBIT_PASSWD +sudo rabbitmqctl set_user_tags $RABBIT_USER administrator +sudo rabbitmqctl add_vhost $RABBIT_VHOST +sudo rabbitmqctl set_permissions -p $RABBIT_VHOST $RABBIT_USER ".*" ".*" ".*" +EOF + exit 1 + fi +} + +# Replace nova flavours +function replace_nova_flavors { + echo " * Removing nova flavors ..." + for id in $(nova flavor-list | awk '$2 ~ /[[:digit:]]/ {print $2}') ; do + echo " * Removing flavor '$id'" + nova flavor-delete $id + done + echo " * Creating new flavors ..." + nova flavor-create m1.small auto 768 40 1 + nova flavor-create m1.medium auto 1024 40 1 + nova flavor-create m1.large auto 1280 40 2 +} + +# Create security group rules +function add_nova_secgroups { + echo " * Creating security group rules ..." + sleep 2 + nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0 + sleep 2 + nova secgroup-add-rule default udp 1 65535 0.0.0.0/0 + sleep 2 + nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 + sleep 2 +} + +# Add Murano key +function add_nova_keys { + if [[ -z "$(nova keypair-list | grep murano_)" ]] ; then + echo " * Creating keypair 'murano_*' ..." + sleep 5 + nova keypair-add murano_key > ~/.ssh/murano_key.pub + sleep 2 + nova keypair-add murano-lb-key > ~/.ssh/murano-lb-key.pub + else + echo " * Keypair 'murano_*' already exists" + fi +} + +# Main workflow +replace_nova_flavors +add_nova_secgroups +add_nova_keys + +configure_rabbitmq + +# Restart Apache2 +restart_service apache2 diff --git a/getting-started/localrc b/getting-started/localrc new file mode 100644 index 00000000..2ad389cb --- /dev/null +++ b/getting-started/localrc @@ -0,0 +1,76 @@ +# +# Devstack's config file for Murano Getting Started +# Replace strings '***' with your values. +# + +# Default password for this config +# +default_password='***' + +# Other passwords +# +ADMIN_PASSWORD=$default_password +MYSQL_PASSWORD=$default_password +RABBIT_PASSWORD=$default_password +SERVICE_PASSWORD=$default_password + +SERVICE_TOKEN=tokentoken + + +# IP address of your devstack box +# +HOST_IP='***.***.***.***' + + +# Name of the interface which will be shared with Fixed Network +# +#FLAT_INTERFACE='***' + + +# IP range for Fixed Network +# Addresses which will be assigned to instances at startup are taken from that range +# +FIXED_RANGE='10.0.0.0/24' + + +# IP range fo Floating Network +# +FLOATING_RANGE='***.***.***.***/***' + + +# Enable MySQL backend explicitely +# +ENABLED_SERVICES+=,mysql + + +# Enable Heat +# +ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng + + +# Add Fedora 17 image for load balancer +# +IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2" + + +# Logger settings +# +SCREEN_LOGDIR=/opt/stack/log/ +LOGFILE=$SCREEN_LOGDIR/stack.sh.log + + +# Disable check of API requests rate +# +API_RATE_LIMIT=False + + +# Set NoopFirewallDriver to disable anti-spoofing rules +# +LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver + + +# Extra options for nova.conf +# +EXTRA_OPTS=(force_config_drive=true libvirt_images_type=qcow2 force_raw_images=false) + + diff --git a/getting-started/provision.sh b/getting-started/provision.sh new file mode 100644 index 00000000..de7495d7 --- /dev/null +++ b/getting-started/provision.sh @@ -0,0 +1,40 @@ +#!/bin/bash -x + +function log { + echo "$@" | tee --append ~/provision.log +} + +apt-get install -y git + +if [ ! -f '/vagrant/lab-binding.rc' ] ; then + echo "File '/vagrant/lab-binding.rc' not found!" + exit 1 +fi + +mkdir /etc/murano-deployment + +if [ ! -f '/etc/murano-deployment/lab-binding.rc' ] ; then + cp /vagrant/lab-binding.rc /etc/murano-deployment +fi + +mkdir /opt/git + +cd /opt/git + +log "Cloning the 'murano-deployment' repository ..." +git clone https://github.com/stackforge/murano-deployment.git >> ~/provision.log + +cd murano-deployment +#git checkout -b release-0.2 origin/release-0.2 + +log "Installing pip ..." +apt-get install python-setuptools >> ~/provision.log +easy_install pip >> ~/provision.log + +cd devbox-scripts +log "Installing murano prerequisites ..." +./murano-git-install.sh prerequisites >> ~/provision.log + +log "Installing murano components ..." +./murano-git-install.sh install >> ~/provision.log + diff --git a/image-builder/share/files/ws-2012-core/autounattend.xml b/image-builder/share/files/ws-2012-core/autounattend.xml index 2974a0b6..a5f2914a 100755 --- a/image-builder/share/files/ws-2012-core/autounattend.xml +++ b/image-builder/share/files/ws-2012-core/autounattend.xml @@ -107,7 +107,7 @@ 2 - %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe Import-Module ServerManager; Install-WindowsFeature NET-Framework-Core –Source D:\Sources\SxS + %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe Import-Module ServerManager; Install-WindowsFeature NET-Framework-Core -Source D:\Sources\SxS Add dot Net 3.5 feature diff --git a/image-builder/share/files/ws-2012-std/autounattend.xml b/image-builder/share/files/ws-2012-std/autounattend.xml index 4c748406..7cc3631b 100755 --- a/image-builder/share/files/ws-2012-std/autounattend.xml +++ b/image-builder/share/files/ws-2012-std/autounattend.xml @@ -107,7 +107,7 @@ 2 - %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe Import-Module ServerManager; Install-WindowsFeature NET-Framework-Core –Source D:\Sources\SxS + %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe Import-Module ServerManager; Install-WindowsFeature NET-Framework-Core -Source D:\Sources\SxS Add dot Net 3.5 feature diff --git a/image-builder/share/scripts/wpi.ps1 b/image-builder/share/scripts/wpi.ps1 index 87ecbd26..d13aa493 100755 --- a/image-builder/share/scripts/wpi.ps1 +++ b/image-builder/share/scripts/wpi.ps1 @@ -174,7 +174,7 @@ function AddToEnvPath() else { $newPath=$oldPath+';'+$addString; - Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH –Value $newPath + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath Log "$addString was add to system PATH"; } } diff --git a/puppet/README.rst b/puppet/README.rst new file mode 100644 index 00000000..4a7738ca --- /dev/null +++ b/puppet/README.rst @@ -0,0 +1,35 @@ +Puppet recepies for Murano components +================== + +How to install Murano using Puppet recepies? + +Need to perform the following commands: + + apt-get install -y git puppet rabbitmq-server + + mkdir -p ~/.puppet/modules + + puppet module install puppetlabs/vcsrepo + + puppet module install puppetlabs/rabbitmq + + puppet module install puppetlabs/inifile + + git clone https://github.com/stackforge/murano-deployment + + cd murano-deployment/puppet + + +After that need to edit recepies (to change default values of parameters) and apply recepies: + + puppet apply puppet_Murano_REST_API.pp + + puppet apply puppet_Murano_Conductor.pp + + puppet apply puppet_Murano_Dashboard.pp + + +SEE ALSO +======== +* `Murano `__ + diff --git a/puppet/puppet_Murano_Conductor.pp b/puppet/puppet_Murano_Conductor.pp index e5a872a0..7ccdabd0 100644 --- a/puppet/puppet_Murano_Conductor.pp +++ b/puppet/puppet_Murano_Conductor.pp @@ -5,11 +5,12 @@ # Need to track all installation actions from puppet recepies class murano::conductor ( - $rabbit_vhost = 'murano', - $rabbit_user = 'murano', + $rabbit_vhost = 'murano', + $rabbit_user = 'murano', $rabbit_password = 'murano', - $rabbit_host = '127.0.0.1', - $keystone_url = 'http://127.0.0.1:5000/v2.0' + $rabbit_host = '127.0.0.1', + $keystone_url = 'http://127.0.0.1:5000/v2.0', + $branch = 'master' ) { rabbitmq_user { "$rabbit_user": admin => true, @@ -33,19 +34,25 @@ class murano::conductor ( ensure => present, provider => git, source => 'git://github.com/stackforge/murano-conductor.git', - revision => 'master', + revision => $branch, alias => 'step1', } + case $operatingsystem { + centos: { $cmd = "sh setup-centos.sh purge-init; sh setup-centos.sh install" } + default: { $cmd = "sh setup.sh purge-init; sh setup.sh install" } + } + exec {'Install new version': require => Vcsrepo['step1'], - command => 'chmod +x setup.sh; ./setup.sh purge-init; ./setup.sh install', + command => $cmd, user => 'root', provider => shell, cwd => '/tmp/murano-conductor', alias => 'step2', } + exec {'Copy configuration files': require => Exec['step2'], command => 'cp conductor.conf.sample conductor.conf', diff --git a/puppet/puppet_Murano_Dashboard.pp b/puppet/puppet_Murano_Dashboard.pp new file mode 100644 index 00000000..95f99fd9 --- /dev/null +++ b/puppet/puppet_Murano_Dashboard.pp @@ -0,0 +1,35 @@ +# TODO: +# 1. tnurlygayanov: Fix issue with configuration files (like in OpenStack projects) +# 2. tnurlygayanov: Fix issue with installation from git repository. +# Now we are use ./setup.sh script from git repository. +# Need to track all installation actions from puppet recepies + +class murano::dashboard ( + $branch = 'master' +) { + + vcsrepo { '/tmp/murano-dashboard': + ensure => present, + provider => git, + source => 'git://github.com/stackforge/murano-dashboard.git', + revision => $branch, + alias => 'step1', + } + + case $operatingsystem { + centos: { $cmd = "sh setup-centos.sh install" } + default: { $cmd = "sh setup.sh install" } + } + + exec {'Install new version': + require => Vcsrepo['step1'], + command => $cmd, + user => 'root', + provider => shell, + cwd => '/tmp/murano-dashboard', + } + +} + +class { 'murano::dashboard': } + diff --git a/puppet/puppet_Murano_REST_API.pp b/puppet/puppet_Murano_REST_API.pp index 5fd314fd..b711b147 100644 --- a/puppet/puppet_Murano_REST_API.pp +++ b/puppet/puppet_Murano_REST_API.pp @@ -18,7 +18,8 @@ class murano::api ( $murano_db_user = 'murano', $murano_db_password = 'murano', $murano_db_dbname = 'murano', - $db_host = 'localhost' + $db_host = 'localhost', + $brach = 'master' ) { case $db_type { @@ -49,13 +50,18 @@ class murano::api ( ensure => present, provider => git, source => 'git://github.com/stackforge/murano-api.git', - revision => 'master', + revision => $branch, alias => 'step1', } + case $operatingsystem { + centos: { $cmd = "sh setup-centos.sh purge-init; sh setup-centos.sh install" } + default: { $cmd = "sh setup.sh purge-init; sh setup.sh install" } + } + exec {'Install new version': require => Vcsrepo['step1'], - command => 'chmod +x setup.sh; ./setup.sh purge-init; ./setup.sh install', + command => $cmd, user => 'root', provider => shell, cwd => '/tmp/murano-api',