Merge "Add Vagrantfile for deploying DevStack in a VM"

This commit is contained in:
Jenkins 2016-06-24 03:55:36 +00:00 committed by Gerrit Code Review
commit 46c3772f71
2 changed files with 128 additions and 0 deletions

View File

@ -74,6 +74,13 @@ Or you can use "\*" as a wild card, like below.
Select @timestamp as time-field name.
# Using Vagrant
Vagrant can be used to deploy a VM with Devstack and Monasca Logging
running in it using the Vagrantfile. After installing Vagrant,
just run the command `vagrant up` as usual in the `monasca-log-api/devstack`
directory.
```
# Copyright 2016 FUJITSU LIMITED
#

121
devstack/Vagrantfile vendored Normal file
View File

@ -0,0 +1,121 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
# Handle local proxy settings
if Vagrant.has_plugin?("vagrant-proxyconf")
if ENV["http_proxy"]
config.proxy.http = ENV["http_proxy"]
end
if ENV["https_proxy"]
config.proxy.https = ENV["https_proxy"]
end
if ENV["no_proxy"]
config.proxy.no_proxy = ENV["no_proxy"] + ',192.168.10.6,10.0.2.15'
end
end
config.vm.hostname = "devstack"
config.vm.box = "ubuntu/trusty64"
# config.vm.box_check_update = false
config.vm.network "private_network",ip:"192.168.10.6"
config.vm.synced_folder "~/", "/vagrant_home"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "12800"
vb.cpus = 4
# vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
end
config.vm.provision "shell", privileged: false, inline: <<-SHELL
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install git
if [ $http_proxy ]; then
git config --global url.https://git.openstack.org/.insteadOf git://git.openstack.org/
sudo git config --global url.https://git.openstack.org/.insteadOf git://git.openstack.org/
protocol=`echo $http_proxy | awk -F: '{print $1}'`
host=`echo $http_proxy | awk -F/ '{print $3}' | awk -F: '{print $1}'`
port=`echo $http_proxy | awk -F/ '{print $3}' | awk -F: '{print $2}'`
echo "<settings>
<proxies>
<proxy>
<id>$host</id>
<active>true</active>
<protocol>$protocol</protocol>
<host>$host</host>
<port>$port</port>
</proxy>
</proxies>
</settings>" > ./maven_proxy_settings.xml
mkdir ~/.m2
cp ./maven_proxy_settings.xml ~/.m2/settings.xml
sudo mkdir /root/.m2
sudo cp ./maven_proxy_settings.xml /root/.m2/settings.xml
fi
git clone https://git.openstack.org/openstack-dev/devstack -b master
sudo pip install numpy
sudo pip install python-monascaclient
cd devstack
echo '[[local|localrc]]
SERVICE_HOST=192.168.10.6
HOST_IP=192.168.10.6
HOST_IP_IFACE=eth1
MYSQL_HOST=192.168.10.6
MYSQL_PASSWORD=secretmysql
DATABASE_PASSWORD=secretdatabase
RABBIT_PASSWORD=secretrabbit
ADMIN_PASSWORD=secretadmin
SERVICE_PASSWORD=secretservice
LOGFILE=$DEST/logs/stack.sh.log
LOGDIR=$DEST/logs
LOG_COLOR=False
disable_all_services
enable_service rabbit mysql key tempest horizon
# The following two variables allow switching between Java and Python for the implementations
# of the Monasca API and the Monasca Persister. If these variables are not set, then the
# default is to install the Python implementations of both the Monasca API and the Monasca Persister.
# Uncomment one of the following two lines to choose Java or Python for the Monasca API.
# MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-java}
MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-python}
# Uncomment one of the following two lines to choose Java or Python for the Monasca Pesister.
# MONASCA_PERSISTER_IMPLEMENTATION_LANG=${MONASCA_PERSISTER_IMPLEMENTATION_LANG:-java}
MONASCA_PERSISTER_IMPLEMENTATION_LANG=${MONASCA_PERSISTER_IMPLEMENTATION_LANG:-python}
# Uncomment one of the following two lines to choose either InfluxDB or Vertica.
# MONASCA_METRICS_DB=${MONASCA_METRICS_DB:-vertica}
MONASCA_METRICS_DB=${MONASCA_METRICS_DB:-influxdb}
# Uncomment one of the following lines and modify accordingly to enable the Monasca DevStack Plugin
enable_plugin monasca-api https://git.openstack.org/openstack/monasca-api
# enable_plugin monasca-api file:///vagrant_home/Documents/repos/openstack/monasca-api.vertica
enable_plugin monasca-log-api https://github.com/openstack/monasca-log-api.git
' > local.conf
./stack.sh
SHELL
end