-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall-heat
executable file
·165 lines (143 loc) · 5.13 KB
/
install-heat
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/bin/bash
set -e
DATABASE_PASSWORD="moofoo"
RABBITMQ_PASSWORD="notset"
REGION="az-1.region-a.geo-1"
AUTH_URL="https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/"
if [ -e "localrc" ]
then
echo " * Loading local configuration from 'localrc'..."
source localrc
else
echo " * No localrc is detected... "
fi
echo " * Region will be set to '${REGION}'..."
echo " * Auth URL will be set to '${AUTH_URL}'..."
sleep 3
echo
echo "=== Installing Heat ==="
echo
echo " * Fetching necessary information..."
PUBLIC_IP="$(curl http://169.254.169.254/latest/meta-data/public-ipv4 2> /dev/null)"
echo " * Preseeding mysql server configuration..."
cat << MYSQL_PRESEED | sudo debconf-set-selections
mysql-server mysql-server/root_password password ${DATABASE_PASSWORD}
mysql-server mysql-server/root_password_again password ${DATABASE_PASSWORD}
mysql-server mysql-server/start_on_boot boolean true
MYSQL_PRESEED
echo " * Installing packages including rabbitmq-server and mysql-server..."
sudo apt-get --quiet update
sudo apt-get --quiet --assume-yes install \
python-setuptools \
python-eventlet \
python-greenlet \
python-httplib2 \
python-iso8601 \
python-lxml \
python-sqlalchemy \
python-paste \
python-routes \
python-webob \
python-yaml \
python-mysqldb \
python-dev \
python-pip \
git-core \
python-setuptools \
gcc \
libc6-dev \
libxml2-dev \
libxslt-dev \
libz-dev \
python-prettytable \
mysql-server \
rabbitmq-server
echo " * Updating rabbitmq password..."
sudo rabbitmqctl change_password guest "${RABBITMQ_PASSWORD}"
echo " * Downloading heat..."
if [ -d heat/.git ] ; then
pushd heat
git stash
git pull
popd
else
git clone --quiet git://github.com/openstack/heat.git
fi
cd heat
echo " * Installing additional python dependencies..."
#XXX: Work around 'TypeError: dist must be a Distribution instance'.
sudo pip install --quiet requests==1.2.2
sudo pip install --quiet -r requirements.txt
# XXX: test packages needed due to bug in plugin loading in heat
sudo pip install --quiet -r test-requirements.txt
echo " * Installing heat package in 'developer mode'..."
sudo python setup.py develop --quiet
sudo pip install --quiet python-heatclient
echo " * Patching heat to run against HP Cloud..."
git apply << EOF
diff --git a/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py b/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py
index 28de5d9..8382f14 100644
--- a/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py
+++ b/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py
@@ -195,6 +195,8 @@ class KeystoneClientV2(object):
self.client.users.update_enabled(user_id, True)
def url_for(self, **kwargs):
+ default_region_name = cfg.CONF.region_name_for_services
+ kwargs.setdefault('region_name', default_region_name)
return self.client.service_catalog.url_for(**kwargs)
@property
EOF
echo " * Installing heat configuration files into '/etc/heat/'..."
sudo cp -r etc/heat /etc/
sudo chown -R `whoami` /etc/heat
echo " * Updating heat configuration files..."
cat > /etc/heat/heat.conf << EOF
[DEFAULT]
rabbit_password = ${RABBITMQ_PASSWORD}
auth_encryption_key = $(hexdump -n 16 -v -e '/1 "%02x"' /dev/random)
heat_metadata_server_url = http://${PUBLIC_IP}:8000
heat_waitcondition_server_url = http://${PUBLIC_IP}:8000/v1/waitcondition
heat_watch_server_url = http://${PUBLIC_IP}:8003
region_name_for_services = ${REGION}
sql_connection = mysql://heat:heat@localhost/heat
debug = True
log_dir = /var/log/heat/
plugin_dirs = /home/ubuntu/heat-hpcloud/heat/contrib/heat_keystoneclient_v2
keystone_backend = heat.engine.plugins.heat_keystoneclient_v2.client.KeystoneClientV2
[keystone_authtoken]
auth_uri = ${AUTH_URL}
[paste_deploy]
flavor = standalone
EOF
echo " * Creating log directory at '/var/log/heat/'..."
sudo mkdir -p /var/log/heat/
echo " * Setting up heat database..."
sudo bin/heat-db-setup deb -r "${DATABASE_PASSWORD}"
sudo chown -R `whoami` /var/log/heat
echo
echo "Now starting heat in the background..."
heat-engine &> /dev/null &
heat-api &> /dev/null &
echo
echo "heat-engine pid: $(pidof -x heat-engine)"
echo "heat-api pid: $(pidof -x heat-api)"
echo "heat logs: /var/log/heat"
echo
echo "To take full advantage of heat, having an image with heat-cfntools is"
echo "important. You can either create an image with it included and ask"
echo "support to upload it for you OR more easily you can boot an instace,"
echo "pip install heat-cfntools, and then create a snapshot from the running"
echo "instance."
echo
echo "Unfortunately, most heat templates will not work with hpcloud due"
echo "to not having the instace flavours or images they expect. They can"
echo "however be easily updated to work successfully. You can find some"
echo "example templates that will work under the templates directory."
echo
echo "To see what patches have been applied to make heat work with hpcloud,"
echo "you can run 'git diff' on the heat directory."
echo
echo "To access heat, export HEAT_URL=http://${PUBLIC_IP}:8004/v1/\${OS_TENANT_ID}"
echo " -- \${OS_TENANT_ID} should be replaced with your tenant ID."
echo "Newer versions of heat client also require: export OS_NO_CLIENT_AUTH=1"
echo