Add vagrant file for setting devstack for Zun
This patch adds necessary files and script for setting up a zun devstack environment through vagrant. This will help to boost productivity of zun developers. Implements: blueprint vagrant-support-zun Change-Id: Iacbf777b46208d7b1d52390b9c4a3c5a4229573e
This commit is contained in:
parent
2909374a77
commit
6e3d3e414b
15
contrib/vagrant/README.md
Normal file
15
contrib/vagrant/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
vagrant-devstack-zun
|
||||
=======================
|
||||
|
||||
A Vagrant based devstack setup for zun.
|
||||
Steps to try vagrant image:
|
||||
1. Install virtual-box and vagrant on your local machine.
|
||||
2. Git clone zun repository.
|
||||
3. cd zun/contrib/vagrant
|
||||
4. vagrant up
|
||||
It will take around 20 mins.
|
||||
5. vagrant ssh
|
||||
You will get vm shell with all necessary setup.
|
||||
|
||||
Note: For enabling/disabling various services, please see below file:
|
||||
zun/contrib/vagrant/config/localrc
|
23
contrib/vagrant/Vagrantfile
vendored
Normal file
23
contrib/vagrant/Vagrantfile
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
#https://atlas.hashicorp.com/bento/boxes/ubuntu-16.04
|
||||
config.vm.box = "bento/ubuntu-16.04"
|
||||
|
||||
#below box has an issue, https://bugs.launchpad.net/cloud-images/+bug/1569237
|
||||
#config.vm.box_url = "https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-vagrant.box"
|
||||
|
||||
config.vm.hostname = "devstack"
|
||||
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.customize ["modifyvm", :id, "--memory", "4096"]
|
||||
end
|
||||
|
||||
config.vm.provision :shell, :path => "provision.sh"
|
||||
|
||||
if Vagrant.has_plugin?("vagrant-cachier")
|
||||
config.cache.scope = :box
|
||||
end
|
||||
|
||||
end
|
27
contrib/vagrant/config/localrc
Normal file
27
contrib/vagrant/config/localrc
Normal file
@ -0,0 +1,27 @@
|
||||
HOST_IP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
DATABASE_PASSWORD=password
|
||||
RABBIT_PASSWORD=password
|
||||
SERVICE_TOKEN=password
|
||||
SERVICE_PASSWORD=password
|
||||
ADMIN_PASSWORD=password
|
||||
enable_plugin zun https://git.openstack.org/openstack/zun
|
||||
|
||||
#Optional: uncomment to enable the Zun UI plugin in Horizon
|
||||
#enable_plugin zun-ui https://git.openstack.org/openstack/zun-ui
|
||||
|
||||
#Uncomment below variables and enable nova and neutron
|
||||
#services to use nova docker driver
|
||||
#ZUN_DRIVER=nova-docker
|
||||
#IP_VERSION=4
|
||||
disable_service n-api,n-cpu,n-cond,n-sch,n-novnc,n-cauth
|
||||
disable_service q-svc,q-dhcp,q-meta,q-agt,q-l3
|
||||
disable_service neutron
|
||||
|
||||
#comment out below line to use Horizon Dashboard
|
||||
disable_service horizon
|
||||
|
||||
#comment out below line to use Cinder
|
||||
disable_service c-sch,c-api,c-vol
|
||||
|
||||
#comment out below line to use tempest
|
||||
disable_service tempest
|
37
contrib/vagrant/install_devstack.sh
Normal file
37
contrib/vagrant/install_devstack.sh
Normal file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
export OS_USER=vagrant
|
||||
|
||||
BASHPATH=$(dirname "$0"\")
|
||||
echo "run script from $BASHPATH"
|
||||
|
||||
# update system
|
||||
export DEBIAN_FRONTEND noninteractive
|
||||
sudo apt-get update
|
||||
sudo apt-get install -qqy git
|
||||
|
||||
# determine checkout folder
|
||||
PWD=$(su "$OS_USER" -c "cd && pwd")
|
||||
DEVSTACK=$PWD/devstack
|
||||
|
||||
# check if devstack is already there
|
||||
if [ ! -d "$DEVSTACK" ]
|
||||
then
|
||||
echo "Download devstack into $DEVSTACK"
|
||||
|
||||
# clone devstack
|
||||
su "$OS_USER" -c "cd && git clone -b master https://github.com/openstack-dev/devstack.git $DEVSTACK"
|
||||
|
||||
echo "Copy configuration"
|
||||
|
||||
# copy localrc settings (source: devstack/samples/localrc)
|
||||
echo "copy config from $BASHPATH/config/localrc to $DEVSTACK/localrc"
|
||||
cp "$BASHPATH"/config/localrc "$DEVSTACK"/localrc
|
||||
chown "$OS_USER":"$OS_USER" "$DEVSTACK"/localrc
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# start devstack
|
||||
echo "Start Devstack"
|
||||
su "$OS_USER" -c "cd $DEVSTACK && ./stack.sh"
|
5
contrib/vagrant/provision.sh
Normal file
5
contrib/vagrant/provision.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# run script
|
||||
sh /vagrant/install_devstack.sh
|
Loading…
Reference in New Issue
Block a user