diff --git a/contrib/vagrant/README.md b/contrib/vagrant/README.md new file mode 100644 index 000000000..f3864e609 --- /dev/null +++ b/contrib/vagrant/README.md @@ -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 diff --git a/contrib/vagrant/Vagrantfile b/contrib/vagrant/Vagrantfile new file mode 100644 index 000000000..a0cf1a6ce --- /dev/null +++ b/contrib/vagrant/Vagrantfile @@ -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 diff --git a/contrib/vagrant/config/localrc b/contrib/vagrant/config/localrc new file mode 100644 index 000000000..7d02ba1ed --- /dev/null +++ b/contrib/vagrant/config/localrc @@ -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 diff --git a/contrib/vagrant/install_devstack.sh b/contrib/vagrant/install_devstack.sh new file mode 100644 index 000000000..a32985fee --- /dev/null +++ b/contrib/vagrant/install_devstack.sh @@ -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" diff --git a/contrib/vagrant/provision.sh b/contrib/vagrant/provision.sh new file mode 100644 index 000000000..127b8e93f --- /dev/null +++ b/contrib/vagrant/provision.sh @@ -0,0 +1,5 @@ +#!/bin/sh + + +# run script +sh /vagrant/install_devstack.sh