blob: a68a3468c4f7c1eba17d7b39c284c15cc440e4e8 [file] [log] [blame]
Joe Topjian4b6ce842016-07-26 02:15:43 +00001#!/bin/bash
Joe Topjiane361ee82016-07-26 16:46:31 +00002#
3# This script is useful for creating a devstack environment to run gophercloud
4# acceptance tests on.
5#
6# This can be considered a "legacy" devstack environment since it uses
7# Keystone v2 and LBaaS v1.
8#
9# To run, simply execute this script within a virtual machine.
10#
11# The following OpenStack versions are installed:
12# * OpenStack Mitaka
13# * Keystone v2
14# * Glance v1 and v2
15# * Nova v2 and v2.1
16# * Cinder v1 and v2
17# * Trove v1
18# * Swift v1
19# * Neutron v2
20# * Neutron LBaaS v1.0
21# * Neutron FWaaS v2.0
22#
23# Go 1.6 is also installed.
Joe Topjian4b6ce842016-07-26 02:15:43 +000024
25set -e
26
27cd
28sudo apt-get update
29sudo apt-get install -y git make mercurial
30
31sudo wget -O /usr/local/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
32sudo chmod +x /usr/local/bin/gimme
33gimme 1.6 >> .bashrc
34
35mkdir ~/go
36eval "$(/usr/local/bin/gimme 1.6)"
37echo 'export GOPATH=$HOME/go' >> .bashrc
38export GOPATH=$HOME/go
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
86#enable_service q-flavors
87
88# Disable Neutron metering
89disable_service q-metering
90
91# Enable LBaaS V1
92enable_service q-lbaas
93
94# Enable FWaaS
95enable_service q-fwaas
96
97# Enable LBaaS v2
98#enable_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
100#enable_service q-lbaasv2
101#enable_service octavia
102#enable_service o-cw
103#enable_service o-hk
104#enable_service o-hm
105#enable_service o-api
106
107# Enable Trove
108enable_plugin trove git://git.openstack.org/openstack/trove.git stable/\$OPENSTACK_VERSION
109enable_service trove,tr-api,tr-tmgr,tr-cond
110
111# Disable Temptest
112disable_service tempest
113
114# Disable Horizon
115disable_service horizon
116
117# Disable Keystone v2
118#ENABLE_IDENTITY_V2=False
119
120# Enable SSL/tls
121#enable_service tls-proxy
122#USE_SSL=True
123
124# Enable Ceilometer
125#enable_service ceilometer-acompute
126#enable_service ceilometer-acentral
127#enable_service ceilometer-anotification
128#enable_service ceilometer-collector
129#enable_service ceilometer-alarm-evaluator
130#enable_service ceilometer-alarm-notifier
131#enable_service ceilometer-api
132
133# Enable Zaqar
134#enable_plugin zaqar https://github.com/openstack/zaqar
135#enable_service zaqar-server
136
137# Automatically download and register a VM image that Heat can launch
138# For more information on Heat and DevStack see
139# http://docs.openstack.org/developer/heat/getting_started/on_devstack.html
140#IMAGE_URLS+=",http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2"
141#IMAGE_URLS+=",https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img"
142
143# Logging
144LOGDAYS=1
145LOGFILE=/opt/stack/logs/stack.sh.log
146LOGDIR=/opt/stack/logs
147EOF
148./stack.sh
149
150# Patch openrc
151#cat >> openrc <<EOF
152#
153# Currently, in order to use openstackclient with Identity API v3,
154# we need to set the domain which the user and project belong to.
155#if [ "$OS_IDENTITY_API_VERSION" = "3" ]; then
156# export OS_USER_DOMAIN_ID=${OS_USER_DOMAIN_ID:-"default"}
157# export OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID:-"default"}
158#fi
159#EOF
160
161# Prep the testing environment by creating the required testing resources and environment variables
162source openrc admin
163wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
164glance image-create --name CirrOS --disk-format qcow2 --container-format bare < cirros-0.3.4-x86_64-disk.img
165nova flavor-create m1.tform 99 512 5 1 --ephemeral 10
166_NETWORK_ID=$(nova net-list | grep private | awk -F\| '{print $2}' | tr -d ' ')
167_EXTGW_ID=$(nova net-list | grep public | awk -F\| '{print $2}' | tr -d ' ')
168_IMAGE_ID=$(nova image-list | grep CirrOS | awk -F\| '{print $2}' | tr -d ' ' | head -1)
169echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc
170echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc
171echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc
172echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc
173echo export OS_POOL_NAME="public" >> openrc
174echo export OS_FLAVOR_ID=99 >> openrc
175source openrc demo