/
stackme.sh
executable file
·99 lines (81 loc) · 2.91 KB
/
stackme.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
BARBICAN_PATCH="stable/mitaka"
OCTAVIA_PATCH="stable/mitaka"
NEUTRON_LBAAS_PATCH="stable/mitaka"
NEUTRON_CLIENT_PATCH="stable/mitaka"
# Quick sanity check (should be run on Ubuntu 14.04 and MUST be run as root directly)
if [ `lsb_release -rs` != "14.04" ]
then
echo -n "Warning: This script is only tested against Ubuntu 14.04. Press <enter> to continue at your own risk... "
read
fi
if [ `whoami` != "root" -o -n "$SUDO_COMMAND" ]
then
echo "This script must be run as root, and not using 'sudo'!"
exit 1
fi
# Set up the packages we need
apt-get update
apt-get install git vim -y
# Clone the devstack repo
git clone https://github.com/openstack-dev/devstack.git /tmp/devstack
cd /tmp/devstack
git checkout stable/mitaka
cd -
cat >/tmp/devstack/localrc <<EOF
NOVA_BRANCH="stable/mitaka"
GLANCE_BRANCH="stable/mitaka"
NEUTRON_BRANCH="stable/mitaka"
KEYSTONE_BRANCH="stable/mitaka"
EOF
wget -O - https://raw.githubusercontent.com/rm-you/devstack_deploy/master/localrc >> /tmp/devstack/localrc
# Create the stack user
/tmp/devstack/tools/create-stack-user.sh
# Move everything into place
mv /tmp/devstack /opt/stack/
chown -R stack:stack /opt/stack/devstack/
git clone https://github.com/openstack/octavia ~stack/octavia
cd ~stack/octavia
git checkout $OCTAVIA_PATCH
sed -i 's:octavia:octavia stable/mitaka:' ~stack/octavia/elements/amphora-agent-ubuntu/source-repository-amphora-agent
cd -
cat >>/opt/stack/.profile <<EOF
# Prepare patches for localrc
export BARBICAN_PATCH="$BARBICAN_PATCH"
export NEUTRON_LBAAS_PATCH="$NEUTRON_LBAAS_PATCH"
export OCTAVIA_PATCH="$OCTAVIA_PATCH"
EOF
# Use the openstack mirrors for pip
NODEPOOL_REGION=dfw
NODEPOOL_CLOUD=rax
NODEPOOL_MIRROR_HOST=mirror.$NODEPOOL_REGION.$NODEPOOL_CLOUD.openstack.org
NODEPOOL_MIRROR_HOST=$(echo $NODEPOOL_MIRROR_HOST|tr '[:upper:]' '[:lower:]')
NODEPOOL_PYPI_MIRROR=http://$NODEPOOL_MIRROR_HOST/pypi/simple
NODEPOOL_WHEEL_MIRROR=http://$NODEPOOL_MIRROR_HOST/wheel/ubuntu-14.04-x86_64/
cat >/etc/pip.conf <<EOF
[global]
timeout = 60
index-url = $NODEPOOL_PYPI_MIRROR
trusted-host = $NODEPOOL_MIRROR_HOST
extra-index-url = $NODEPOOL_WHEEL_MIRROR
EOF
cat >/opt/stack/.pydistutils.cfg <<EOF
[easy_install]
index_url = $NODEPOOL_PYPI_MIRROR
allow_hosts = *.openstack.org
EOF
# Let's rock
su - stack -c /opt/stack/devstack/stack.sh
# Update neutron client if necessary
if [ -n "$NEUTRON_CLIENT_PATCH" ]
then
su - stack -c "cd python-neutronclient && git fetch https://review.openstack.org/openstack/python-neutronclient $NEUTRON_CLIENT_PATCH && git checkout FETCH_HEAD && sudo python setup.py install"
fi
# Install tox globally
pip install tox
# Grab utility scripts from github and add them to stack's .profile
wget -O - https://raw.githubusercontent.com/rm-you/devstack_deploy/master/profile >> /opt/stack/.profile
# Set up barbican container
bash <(curl -sL https://raw.githubusercontent.com/rm-you/devstack_deploy/master/make_container.sh)
# Drop into a shell
su - stack