From 7cbd18a88d1b970e3057eef68ef344d95580fad7 Mon Sep 17 00:00:00 2001 From: Joe Topjian Date: Sat, 12 Dec 2015 23:07:18 +0000 Subject: [PATCH] provider/openstack: DevStack Deploy Script This commit includes a script to deploy a standardized devstack environment for use with development and testing. --- .../providers/openstack/devstack/deploy.sh | 125 ++++++++++++++++++ .../providers/openstack/index.html.markdown | 14 +- 2 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 builtin/providers/openstack/devstack/deploy.sh diff --git a/builtin/providers/openstack/devstack/deploy.sh b/builtin/providers/openstack/devstack/deploy.sh new file mode 100644 index 000000000..2225478e1 --- /dev/null +++ b/builtin/providers/openstack/devstack/deploy.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +sudo apt-get update +sudo apt-get install -y git make mercurial + +GOPKG=go1.5.2.linux-amd64.tar.gz +wget https://storage.googleapis.com/golang/$GOPKG +sudo tar -xvf $GOPKG -C /usr/local/ + +mkdir ~/go +echo 'export GOPATH=$HOME/go' >> .bashrc +echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> .bashrc +source .bashrc +export GOPATH=$HOME/go +export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin + +go get github.com/hashicorp/terraform +cd $GOPATH/src/github.com/hashicorp/terraform +make updatedeps + +cd +git clone https://git.openstack.org/openstack-dev/devstack -b stable/liberty +cd devstack +cat >local.conf <> openrc +echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc +echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc +echo export OS_POOL_NAME="public" >> openrc +echo export OS_FLAVOR_ID=99 >> openrc +source openrc demo + +cd $GOPATH/src/github.com/hashicorp/terraform +make updatedeps + +# Replace the below lines with the repo/branch you want to test +#git remote add jtopjian https://github.com/jtopjian/terraform +#git fetch jtopjian +#git checkout --track jtopjian/openstack-acctest-fixes +#make testacc TEST=./builtin/providers/openstack TESTARGS='-run=AccBlockStorageV1' +#make testacc TEST=./builtin/providers/openstack TESTARGS='-run=AccCompute' +#make testacc TEST=./builtin/providers/openstack diff --git a/website/source/docs/providers/openstack/index.html.markdown b/website/source/docs/providers/openstack/index.html.markdown index be918a465..e24857193 100644 --- a/website/source/docs/providers/openstack/index.html.markdown +++ b/website/source/docs/providers/openstack/index.html.markdown @@ -64,7 +64,7 @@ The following arguments are supported: service catalog. It can be set using the OS_ENDPOINT_TYPE environment variable. If not set, public endpoints is used. -## Testing +## Testing and Development In order to run the Acceptance Tests for development, the following environment variables must also be set: @@ -79,3 +79,15 @@ variables must also be set: * `OS_POOL_NAME` - The name of a Floating IP pool. * `OS_NETWORK_ID` - The UUID of a network in your test environment. + +To make development easier, the `builtin/providers/openstack/devstack/deploy.sh` +script will assist in installing and configuring a standardized +[DevStack](http://docs.openstack.org/developer/devstack/) environment along with +Golang, Terraform, and all development dependencies. It will also set the required +environment variables in the `devstack/openrc` file. + +Do not run the `deploy.sh` script on your workstation or any type of production +server. Instead, run the script within a disposable virtual machine. +[Here's](https://github.com/berendt/terraform-configurations) an example of a +Terraform configuration that will create an OpenStack instance and then install and +configure DevStack inside.