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.

Change-Id: I07b2562545e891490bdc6e2d41a804aad8f3ba7f
This commit is contained in:
Dmitry Teselkin 2013-09-04 14:52:03 +04:00
parent 0d1a1baba6
commit 2dc524f73d
7 changed files with 557 additions and 0 deletions

View File

@ -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 <http://murano.mirantis.com>`__

121
getting-started/Vagrantfile vendored Normal file
View File

@ -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

View File

@ -0,0 +1,69 @@
#
# 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'
BRANCH_NAME='release-0.2'
# 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"

View File

@ -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."

146
getting-started/local.sh Executable file
View File

@ -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

76
getting-started/localrc Normal file
View File

@ -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)

View File

@ -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