Skip to content

Instantly share code, notes, and snippets.

@banzo
Forked from MartinPaulo/DevstackVagrant.md
Last active June 27, 2017 14:20
Show Gist options
  • Save banzo/9ce67ec1425173f4dd67dcbae91844d9 to your computer and use it in GitHub Desktop.
Save banzo/9ce67ec1425173f4dd67dcbae91844d9 to your computer and use it in GitHub Desktop.
Devstack IceHouse in a Vagrant box...

Boxing devstack with Vagrant...

The simplest way is to install the latest version of Vagrant

To install a specific branch of devstack

These are the steps I followed to install the Newton branch of devstack into a Vagrant controlled VM

vagrant init bento/ubuntu-16.04
nano Vagrantfile

Then in the resultant edit window alter the Vagrant file to be as follows:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "bento/ubuntu-16.04"

  # set up the the network
  config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
  config.vm.network "forwarded_port", guest: 6080, host: 8081, host_ip: "127.0.0.1"

  # and the amount of memory and cpu's to use
  config.vm.provider "virtualbox" do |vb|
      vb.customize ["modifyvm", :id, "--memory", "4096"]
      vb.customize ["modifyvm", :id, "--cpus", "2"]
  end

end

Bring the VM up and ssh into it...

vagrant up && vagrant ssh

Once in the VM bring it up to date and install git

sudo apt-get update && sudo apt-get -y install git

Then fetch devstack and change into its directory...

git clone git://git.openstack.org/openstack-dev/devstack && cd devstack

Switch to the icehouse branch

git checkout stable/newton

Then fire up devstack

./stack.sh

Provide the requested passwords, etc..

Once up, the dashboard is available from the host computer at http://localhost:8080/. Your users are 'admin' and 'demo', and the password is the one that you provided when answering the stack.sh questions...

In the VM you can source the openrc file to enable credentials for command line tools as the demo user.

source ~devstack/openrc

NB: If you want to be the admin user on the command line, source with 'admin' as an argument

source ~devstack/openrc admin

To stop devstack,

./unstack.sh

To run devstack off line, in openrc add the line (but note that devstack must have been run successfully with Internet access prior to doing this)

OFFLINE=True

To force devstack to update all of the repositories when it runs, in openrc add the line

RECLONE=yes

And if using the command line tools, once you've sourced openrc you can generate a keypair to use as follows

#to generate a keypair to use...
nova keypair-add heat_key > heat_key.priv
chmod 600 heat_key.priv

If you start devstack, sign in via the dashboard, then restart devstack, you might find that your browser still is associated with the old session, hence you get a big django exception when you return to the dashboard. Simply visit http://localhost:8080/auth/logout to clear the old session...

The above is a little out of date when talking about localrc. For more on setting the conf files, see:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment