Added some more vagrant testing steps

Also added `$` to front of all sample shell commands.
* Helps ensure user knows it is a command to be run from CLI
* Also discourages bulk copy/paste running of the commands directly from example ( bad practice! )

Change-Id: I7484d77dc3575bb9784ffa6b44437a4f02c63cc8
This commit is contained in:
paulczar 2013-11-09 14:35:58 -06:00
parent b50247e3ea
commit 621c21665c
1 changed files with 77 additions and 17 deletions

View File

@ -1,21 +1,81 @@
# Testing with Vagrant #
## Prerequisites ##
The allinone-compute role may be tested with Vagrant, currently with Ubuntu 12.04 and 13.04. You need the following prerequisites:
1. You must have Vagrant 1.2.1 or later installed.
2. You must have a "sane" Ruby 1.9.3 environment.
3. You must have the following Vagrant plugins:
vagrant plugin install vagrant-omnibus
vagrant plugin install vagrant-chef-zero
vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-omnibus
$ vagrant plugin install vagrant-chef-zero
$ vagrant plugin install vagrant-berkshelf
__notes:__
* Vagrant plugins must be installed in the described order.
* If you have issues with berkshelf, you may need to use a previous version of vagrant-chef-zero.
## Starting the allinone-compute node ##
To test with Ubuntu 12.04, run:
vagrant up ubuntu1204
$ vagrant up ubuntu1204
To test with Ubuntu 13.04, run:
vagrant up ubuntu1304
$ vagrant up ubuntu1304
## Further testing ##
Now you have an openstack, you'll probably want to be able to actually launch instances.
### Log into box, prepare environment ###
$ vagrant ssh ubuntu1204
$ sudo bash
$ source /root/openrc
### Basic health checks ###
$ nova service-list
$ keystone catalog
### Working with Glance images ###
$ glance image-list
$ wget -q -O - https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img \
| glance image-create --name=cirros --disk-format=qcow2 --container-format=bare
$ glance image-list
### Working with Security Groups ###
$ nova secgroup-list
$ nova secgroup-list-rules default
$ nova secgroup-create allow_ssh "allow ssh to instance"
$ nova secgroup-add-rule allow_ssh tcp 22 22 0.0.0.0/0
$ nova secgroup-list-rules allow_ssh
### Working with keys ###
$ ssh-keygen
$ nova keypair-add --pub-key=/root/.ssh/id_rsa.pub testing
### Create an instance ###
$ nova flavor-list
$ nova boot --flavor=1 --image=cirros --security-groups=allow_ssh --key-name=testing testserver
wait a few seconds and the run `nova list` if Status is not Active, wait a few seconds and repeat.
Once status is active you should be able to log in via ssh to the listed IP.
$ ssh 192.168.100.2
# Testing with Vagabond #
@ -25,7 +85,7 @@ are used during integration testing.
To set up Vagabond, do this:
bundle exec vagabond init
$ bundle exec vagabond init
When prompted, answer "N" to not overwrite the existing Vagabondfile, and then
answer "n" for all templates you don't want to use and "y" for the rest.
@ -47,7 +107,7 @@ following:
To start the local Chef 11 server LXC instance using Vagabond:
bundle exec vagabond server up
$ bundle exec vagabond server up
The above will automatically upload the roles and environment
definitions in this Chef repo along with all of the cookbooks
@ -55,17 +115,17 @@ in the Berkshelf.
To re-upload all of the cookbooks in the Berkshelf, simply do:
bundle exec vagabond server upload_cookbooks
$ bundle exec vagabond server upload_cookbooks
To re-upload the roles or environment files:
bundle exec vagabond server upload_roles
bundle exec vagabond server upload_environments
$ bundle exec vagabond server upload_roles
$ bundle exec vagabond server upload_environments
Remember that the above will install the **current** Berkshelf. Remember to
run:
bundle exec berks update
$ bundle exec berks update
before you do the `vagabond server upload_cookbooks` command.
@ -74,27 +134,27 @@ before you do the `vagabond server upload_cookbooks` command.
To start any of the LXC instances that represent the different ops, controller
and worker nodes in an OpenStack environment, do:
bundle exec vagabond up <NODE>
$ bundle exec vagabond up <NODE>
If you make changes to cookbooks and issue a `vagabond server upload_cookbooks` or
role/environment definitions, you will want to re-provision the node, which basically
ensures the node is up and runs chef-client on it:
bundle exec vagabond provision <NODE>
$ bundle exec vagabond provision <NODE>
To destroy a node:
bundle exec vagabond destroy <NODE>
$ bundle exec vagabond destroy <NODE>
To entirely rebuild a node from scratch:
bundle exec vagabond rebuild <NODE>
$ bundle exec vagabond rebuild <NODE>
When a node is up, you can SSH into that node to run tests or investigate logs, etc:
bundle exec vagabond ssh <NODE>
$ bundle exec vagabond ssh <NODE>
To see the status of all the nodes that Vagabond is managing, including the IP addresses
that the containers are bound to:
bundle exec vagabond status
$ bundle exec vagabond status