blob: 69efca96786a5f80e1110ba036311ef150728460 [file] [log] [blame]
Joe Topjian7c8dd022016-09-01 12:02:04 -06001#!/bin/bash
2#
3# This script is useful for creating a devstack environment to run gophercloud
4# acceptance tests on.
5#
6# To run, simply execute this script within a virtual machine.
7#
8# The following OpenStack versions are installed:
9# * OpenStack Mitaka
10# * Keystone v3
11# * Glance v1 and v2
12# * Nova v2 and v2.1
13# * Cinder v1 and v2
14# * Trove v1
15# * Swift v1
16# * Neutron v2
17# * Neutron LBaaS v2.0
18# * Neutron FWaaS v2.0
19#
20# Go 1.6 is also installed.
21
22set -e
23
24cd
25sudo apt-get update
26sudo apt-get install -y git make mercurial
27
28sudo wget -O /usr/local/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
29sudo chmod +x /usr/local/bin/gimme
30gimme 1.6 >> .bashrc
31
32mkdir ~/go
33eval "$(/usr/local/bin/gimme 1.6)"
34echo 'export GOPATH=$HOME/go' >> .bashrc
35export GOPATH=$HOME/go
36
37export PATH=$PATH:$HOME/terraform:$HOME/go/bin
38echo 'export PATH=$PATH:$HOME/terraform:$HOME/go/bin' >> .bashrc
39source .bashrc
40
41git clone https://git.openstack.org/openstack-dev/devstack -b stable/mitaka
42cd devstack
43cat >local.conf <<EOF
44[[local|localrc]]
45# OpenStack version
46OPENSTACK_VERSION="mitaka"
47
48# devstack password
49DEVSTACK_PASSWORD="password"
50
51# Configure passwords and the Swift Hash
52MYSQL_PASSWORD=\$DEVSTACK_PASSWORD
53RABBIT_PASSWORD=\$DEVSTACK_PASSWORD
54SERVICE_TOKEN=\$DEVSTACK_PASSWORD
55ADMIN_PASSWORD=\$DEVSTACK_PASSWORD
56SERVICE_PASSWORD=\$DEVSTACK_PASSWORD
57SWIFT_HASH=\$DEVSTACK_PASSWORD
58
59# Configure the stable OpenStack branches used by DevStack
60# For stable branches see
61# http://git.openstack.org/cgit/openstack-dev/devstack/refs/
62CINDER_BRANCH=stable/\$OPENSTACK_VERSION
63CEILOMETER_BRANCH=stable/\$OPENSTACK_VERSION
64GLANCE_BRANCH=stable/\$OPENSTACK_VERSION
65HEAT_BRANCH=stable/\$OPENSTACK_VERSION
66HORIZON_BRANCH=stable/\$OPENSTACK_VERSION
67KEYSTONE_BRANCH=stable/\$OPENSTACK_VERSION
68NEUTRON_BRANCH=stable/\$OPENSTACK_VERSION
69NOVA_BRANCH=stable/\$OPENSTACK_VERSION
70SWIFT_BRANCH=stable/\$OPENSTACK_VERSION
71ZAQAR_BRANCH=stable/\$OPENSTACK_VERSION
72
73# Enable Swift
74enable_service s-proxy
75enable_service s-object
76enable_service s-container
77enable_service s-account
78
79# Disable Nova Network and enable Neutron
80disable_service n-net
81enable_service q-svc
82enable_service q-agt
83enable_service q-dhcp
84enable_service q-l3
85enable_service q-meta
86enable_service q-flavors
87
88# Disable Neutron metering
89disable_service q-metering
90
91# Enable LBaaS V1
92#enable_service q-lbaas
93
94# Enable FWaaS
95enable_service q-fwaas
96
97# Enable LBaaS v2
98enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas stable/\$OPENSTACK_VERSION
99#enable_plugin octavia https://git.openstack.org/openstack/octavia stable/\$OPENSTACK_VERSION
100enable_plugin octavia https://git.openstack.org/openstack/octavia
101enable_service q-lbaasv2
102enable_service octavia
103enable_service o-cw
104enable_service o-hm
105enable_service o-hk
106enable_service o-api
107
108# Octavia
109OCTAVIA_AUTH_VERSION=3
110
111# Enable Trove
112#enable_plugin trove git://git.openstack.org/openstack/trove.git stable/\$OPENSTACK_VERSION
113#enable_service trove,tr-api,tr-tmgr,tr-cond
114
115# Disable Temptest
116disable_service tempest
117
118# Disable Horizon
119disable_service horizon
120
121# Disable Keystone v2
122ENABLE_IDENTITY_V2=False
123
124# Enable SSL/tls
125#enable_service tls-proxy
126#USE_SSL=True
127
128# Enable Ceilometer
129#enable_service ceilometer-acompute
130#enable_service ceilometer-acentral
131#enable_service ceilometer-anotification
132#enable_service ceilometer-collector
133#enable_service ceilometer-alarm-evaluator
134#enable_service ceilometer-alarm-notifier
135#enable_service ceilometer-api
136
137# Enable Zaqar
138#enable_plugin zaqar https://github.com/openstack/zaqar
139#enable_service zaqar-server
140
141# Automatically download and register a VM image that Heat can launch
142# For more information on Heat and DevStack see
143# http://docs.openstack.org/developer/heat/getting_started/on_devstack.html
144#IMAGE_URLS+=",http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2"
145#IMAGE_URLS+=",https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img"
146
147# Logging
148LOGDAYS=1
149LOGFILE=/opt/stack/logs/stack.sh.log
150LOGDIR=/opt/stack/logs
151
152[[post-config|\$OCTAVIA_CONF]]
153[default]
154debug = true
155verbose = true
156[keystone_authtoken]
157auth_uri = http://localhost:5000/v3
158auth_url = http://localhost:35357/v3
159user_domain_id = default
160project_name = default
161auth_type = password
162[keystone_authtoken_v3]
163admin_user_domain = default
164admin_project_domain = default
165[[post-config|\$NEUTRON_CONF]]
166[service_auth]
167auth_version = 3
168auth_uri = http://localhost:5000/v3
169auth_url = http://localhost:35357/v3
170admin_user_domain = default
171admin_project_domain = default
172[[post-config|\$NEUTRON_LBAAS_CONF]]
173[service_auth]
174auth_version = 3
175auth_uri = http://localhost:5000/v3
176auth_url = http://localhost:35357/v3
177admin_user_domain = default
178admin_project_domain = default
179EOF
180./stack.sh
181
182# Patch openrc
183cat >> openrc <<EOF
184if [ "\$OS_IDENTITY_API_VERSION" = "3" ]; then
185 export OS_USER_DOMAIN_ID=\${OS_USER_DOMAIN_ID:-"default"}
186 export OS_PROJECT_DOMAIN_ID=\${OS_PROJECT_DOMAIN_ID:-"default"}
187fi
188EOF
189
190# Prep the testing environment by creating the required testing resources and environment variables
191source openrc admin
192wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
193glance image-create --name CirrOS --disk-format qcow2 --container-format bare < cirros-0.3.4-x86_64-disk.img
194nova flavor-create m1.tform 99 512 5 1 --ephemeral 10
195_NETWORK_ID=$(nova net-list | grep private | awk -F\| '{print $2}' | tr -d ' ')
196_EXTGW_ID=$(nova net-list | grep public | awk -F\| '{print $2}' | tr -d ' ')
197_IMAGE_ID=$(nova image-list | grep CirrOS | awk -F\| '{print $2}' | tr -d ' ' | head -1)
198echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc
199echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc
200echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc
201echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc
202echo export OS_POOL_NAME="public" >> openrc
203echo export OS_FLAVOR_ID=99 >> openrc
204source openrc demo