Add files to enable demo kuryr setup using Vagrant

These changes will help developers to quickly setup kuryr along with
docker, keystone and neutron using vagrantfile. Complete steps are
mentioned in ReadMe.

Change-Id: Ia2e16c13a9ae0a6c59991d205f055e3ae8b7b33f
Closes-Bug: #1504018
This commit is contained in:
Vikas Choudhary 2015-10-03 20:09:45 +05:30
parent 3ebedcf80d
commit 036cf9d9c5
8 changed files with 142 additions and 0 deletions

23
contrib/vagrant/README.md Normal file
View File

@ -0,0 +1,23 @@
vagrant-devstack-Kuryr
=======================
A Vagrant based kuryr,neutron,keystone and experimental docker system.
Steps to try vagrant image:
1. Intall virtual-box and vagrant on your local machine.
2. Git clone kuryr repository.
3. cd kuryr/contrib/vagrant
4. vagrant up
It will take around 10 mins.
5. vagrant ssh
You will get vm shell with keystone and neutron already running.
6. cd kuryr && ./scripts/run_kuryr.sh &
Kuryr service will be up and listening on port 2377.
At this point you should have experimental docker, kuryr, neutron, keystone
all up, running and pointing to each other. Any docker network related commands
can be tried now as explained in [1].
References:
[1] https://github.com/openstack/kuryr/blob/master/doc/source/devref/libnetwork_remote_driver_design.rst#L64

21
contrib/vagrant/Vagrantfile vendored Normal file
View File

@ -0,0 +1,21 @@
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "trusty"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.hostname = "devstack"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "4096"]
end
config.vm.provision :shell, :path => "vagrant.sh"
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
end

View File

@ -0,0 +1,5 @@
export SERVICE_USER=admin
export SERVICE_PASSWORD=pass
export SERVICE_TENANT_NAME=admin
export SERVICE_TOKEN=pass
export IDENTITY_URL=http://127.0.0.1:5000/v2.0

View File

@ -0,0 +1,29 @@
OFFLINE=No
RECLONE=No
# Credentials
ADMIN_PASSWORD=pass
DATABASE_PASSWORD=pass
RABBIT_PASSWORD=pass
SERVICE_PASSWORD=pass
SERVICE_TOKEN=pass
HOST_IP=127.0.0.1
ENABLED_SERVICES=True
# Ensure we are using neutron networking rather than nova networking
# (Neutron is enabled by default since Kilo)
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service neutron
enable_service key
enable_service mysql
enable_service rabbit
# Log all output to files
LOGFILE=$HOME/devstack.log
SCREEN_LOGDIR=$HOME/logs

35
contrib/vagrant/devstack.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
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"

2
contrib/vagrant/docker.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
su "$OS_USER" -c "curl -sSL https://experimental.docker.com/ | sh"

View File

@ -0,0 +1,10 @@
#!/bin/sh
echo "running apt-get install python-pip"
sudo apt-get install -qqy python-pip
echo "running git clone kuryr"
su "$OS_USER" -c "cd ~ && git clone -b master https://github.com/openstack/kuryr"
su "$OS_USER" -c "cd ~/kuryr && sudo pip install -r requirements.txt"

17
contrib/vagrant/vagrant.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
export OS_USER=vagrant
export OS_HOST_IP=172.68.5.10
# run script
sh /vagrant/devstack.sh
# install experimetal docker
sh /vagrant/docker.sh
#install kuryr
sh /vagrant/install_kuryr.sh
#set environment variables for kuryr
su "$OS_USER" -c "echo 'source /vagrant/config/kuryr_rc' >> ~/.bashrc"