Browse code

Add support to optionally launch the heat service.

This allows the heat service to be started as a devstack service.

Heat is disabled by default, and can be enabled with this in your localrc:
ENABLED_SERVICES+=,heat

There is now a repo of heat-enabled images here:
https://github.com/heat-api/prebuilt-jeos-images/downloads

These can be added to the IMAGE_URLS in your localrc.

After devstack is launched, a template can be invoked with:
nova keypair-add --pub_key $HOME/.ssh/id_rsa.pub heat_key
heat -d create wordpress \
--template-file=../heat/templates/WordPress_Single_Instance.template \
--parameters="InstanceType=m1.tiny;DBUsername=wpuser;DBPassword=wppassword;\
KeyName=heat_key;LinuxDistribution=F16"

Change-Id: I07591295eb2b9eb7868b1577dd3c24b19812a689

Steve Baker authored on 2012/08/18 06:00:42
Showing 5 changed files
... ...
@@ -34,3 +34,8 @@ catalog.RegionOne.image.publicURL = http://%SERVICE_HOST%:9292
34 34
 catalog.RegionOne.image.adminURL = http://%SERVICE_HOST%:9292
35 35
 catalog.RegionOne.image.internalURL = http://%SERVICE_HOST%:9292
36 36
 catalog.RegionOne.image.name = Image Service
37
+
38
+catalog.RegionOne.heat.publicURL = http://%SERVICE_HOST%:8000/v1
39
+catalog.RegionOne.heat.adminURL = http://%SERVICE_HOST%:8000/v1
40
+catalog.RegionOne.heat.internalURL = http://%SERVICE_HOST%:8000/v1
41
+catalog.RegionOne.heat.name = Heat Service
... ...
@@ -10,6 +10,7 @@
10 10
 # service              quantum   admin        # if enabled
11 11
 # service              swift     admin        # if enabled
12 12
 # service              cinder    admin        # if enabled
13
+# service              heat      admin        # if enabled
13 14
 # demo                 admin     admin
14 15
 # demo                 demo      Member, anotherrole
15 16
 # invisible_to_admin   demo      Member
... ...
@@ -154,6 +155,29 @@ if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then
154 154
     fi
155 155
 fi
156 156
 
157
+# Heat
158
+if [[ "$ENABLED_SERVICES" =~ "heat" ]]; then
159
+    HEAT_USER=$(get_id keystone user-create --name=heat \
160
+                                              --pass="$SERVICE_PASSWORD" \
161
+                                              --tenant_id $SERVICE_TENANT \
162
+                                              --email=heat@example.com)
163
+    keystone user-role-add --tenant_id $SERVICE_TENANT \
164
+                           --user_id $HEAT_USER \
165
+                           --role_id $ADMIN_ROLE
166
+    if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
167
+        HEAT_SERVICE=$(get_id keystone service-create \
168
+            --name=heat \
169
+            --type=orchestration \
170
+            --description="Heat Service")
171
+        keystone endpoint-create \
172
+            --region RegionOne \
173
+            --service_id $HEAT_SERVICE \
174
+            --publicurl "http://$SERVICE_HOST:$HEAT_API_PORT/v1" \
175
+            --adminurl "http://$SERVICE_HOST:$HEAT_API_PORT/v1" \
176
+            --internalurl "http://$SERVICE_HOST:$HEAT_API_PORT/v1"
177
+    fi
178
+fi
179
+
157 180
 # Glance
158 181
 if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
159 182
     GLANCE_USER=$(get_id keystone user-create \
... ...
@@ -296,3 +320,4 @@ if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
296 296
             --internalurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s"
297 297
     fi
298 298
 fi
299
+
299 300
new file mode 100644
... ...
@@ -0,0 +1,156 @@
0
+# lib/heat
1
+# Install and start Heat service
2
+# To enable, add the following to localrc
3
+# ENABLED_SERVICES+=,heat,h-api,h-eng,h-meta
4
+
5
+# Dependencies:
6
+# - functions
7
+
8
+# stack.sh
9
+# ---------
10
+# install_XXX
11
+# configure_XXX
12
+# init_XXX
13
+# start_XXX
14
+# stop_XXX
15
+# cleanup_XXX
16
+
17
+# Print the commands being run so that we can see the command that triggers
18
+# an error.  It is also useful for following along as the install occurs.
19
+set -o xtrace
20
+
21
+
22
+# Defaults
23
+# --------
24
+HEAT_DIR=$DEST/heat
25
+
26
+# set up default directories
27
+
28
+# cleanup_heat() - Remove residual data files, anything left over from previous
29
+# runs that a clean run would need to clean up
30
+function cleanup_heat() {
31
+    # This function intentionally left blank
32
+    :
33
+}
34
+
35
+# configure_heat() - Set config files, create data dirs, etc
36
+function configure_heat() {
37
+    setup_develop $HEAT_DIR
38
+
39
+    HEAT_CONF_DIR=/etc/heat
40
+    if [[ ! -d $HEAT_CONF_DIR ]]; then
41
+        sudo mkdir -p $HEAT_CONF_DIR
42
+    fi
43
+    sudo chown `whoami` $HEAT_CONF_DIR
44
+
45
+    HEAT_API_HOST=${HEAT_API_HOST:-$SERVICE_HOST}
46
+    HEAT_API_PORT=${HEAT_API_PORT:-8000}
47
+    HEAT_ENGINE_HOST=${HEAT_ENGINE_HOST:-$SERVICE_HOST}
48
+    HEAT_ENGINE_PORT=${HEAT_ENGINE_PORT:-8001}
49
+    HEAT_METADATA_HOST=${HEAT_METADATA_HOST:-$SERVICE_HOST}
50
+    HEAT_METADATA_PORT=${HEAT_METADATA_PORT:-8002}
51
+
52
+    HEAT_API_CONF=$HEAT_CONF_DIR/heat-api.conf
53
+    cp $HEAT_DIR/etc/heat-api.conf $HEAT_API_CONF
54
+    iniset $HEAT_API_CONF DEFAULT debug True
55
+    inicomment $HEAT_API_CONF DEFAULT log_file
56
+    iniset $HEAT_API_CONF DEFAULT use_syslog $SYSLOG
57
+    iniset $HEAT_API_CONF DEFAULT bind_host $HEAT_API_HOST
58
+    iniset $HEAT_API_CONF DEFAULT bind_port $HEAT_API_PORT
59
+
60
+    if is_service_enabled rabbit; then
61
+        iniset $HEAT_API_CONF DEFAULT rpc_backend heat.openstack.common.rpc.impl_kombu
62
+        iniset $HEAT_API_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
63
+        iniset $HEAT_API_CONF DEFAULT rabbit_host $RABBIT_HOST
64
+    elif is_service_enabled qpid; then
65
+        iniset $HEAT_API_CONF DEFAULT rpc_backend heat.openstack.common.rpc.impl_qpid
66
+    fi
67
+
68
+    HEAT_API_PASTE_INI=$HEAT_CONF_DIR/heat-api-paste.ini
69
+    cp $HEAT_DIR/etc/heat-api-paste.ini $HEAT_API_PASTE_INI
70
+    iniset $HEAT_API_PASTE_INI filter:authtoken auth_host $KEYSTONE_AUTH_HOST
71
+    iniset $HEAT_API_PASTE_INI filter:authtoken auth_port $KEYSTONE_AUTH_PORT
72
+    iniset $HEAT_API_PASTE_INI filter:authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
73
+    iniset $HEAT_API_PASTE_INI filter:authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0
74
+    iniset $HEAT_API_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
75
+    iniset $HEAT_API_PASTE_INI filter:authtoken admin_user heat
76
+    iniset $HEAT_API_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD
77
+    iniset $HEAT_API_PASTE_INI filter:ec2authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0
78
+    iniset $HEAT_API_PASTE_INI filter:ec2authtoken keystone_ec2_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/ec2tokens
79
+
80
+    HEAT_ENGINE_CONF=$HEAT_CONF_DIR/heat-engine.conf
81
+    cp $HEAT_DIR/etc/heat-engine.conf $HEAT_ENGINE_CONF
82
+    iniset $HEAT_ENGINE_CONF DEFAULT debug True
83
+    inicomment $HEAT_ENGINE_CONF DEFAULT log_file
84
+    iniset $HEAT_ENGINE_CONF DEFAULT use_syslog $SYSLOG
85
+    iniset $HEAT_ENGINE_CONF DEFAULT bind_host $HEAT_ENGINE_HOST
86
+    iniset $HEAT_ENGINE_CONF DEFAULT bind_port $HEAT_ENGINE_PORT
87
+    iniset $HEAT_ENGINE_CONF DEFAULT sql_connection $BASE_SQL_CONN/heat?charset=utf8
88
+    iniset $HEAT_ENGINE_CONF DEFAULT auth_encryption_key `hexdump -n 16 -v -e '/1 "%02x"' /dev/random`
89
+
90
+    if is_service_enabled rabbit; then
91
+        iniset $HEAT_ENGINE_CONF DEFAULT rpc_backend heat.openstack.common.rpc.impl_kombu
92
+        iniset $HEAT_ENGINE_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
93
+        iniset $HEAT_ENGINE_CONF DEFAULT rabbit_host $RABBIT_HOST
94
+    elif is_service_enabled qpid; then
95
+        iniset $HEAT_ENGINE_CONF DEFAULT rpc_backend heat.openstack.common.rpc.impl_qpid
96
+    fi
97
+
98
+    HEAT_ENGINE_PASTE_INI=$HEAT_CONF_DIR/heat-engine-paste.ini
99
+    cp $HEAT_DIR/etc/heat-engine-paste.ini $HEAT_ENGINE_PASTE_INI
100
+    iniset $HEAT_ENGINE_PASTE_INI filter:authtoken auth_host $KEYSTONE_AUTH_HOST
101
+    iniset $HEAT_ENGINE_PASTE_INI filter:authtoken auth_port $KEYSTONE_AUTH_PORT
102
+    iniset $HEAT_ENGINE_PASTE_INI filter:authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
103
+    iniset $HEAT_ENGINE_PASTE_INI filter:authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0
104
+    iniset $HEAT_ENGINE_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
105
+    iniset $HEAT_ENGINE_PASTE_INI filter:authtoken admin_user heat
106
+    iniset $HEAT_ENGINE_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD
107
+
108
+    HEAT_METADATA_CONF=$HEAT_CONF_DIR/heat-metadata.conf
109
+    cp $HEAT_DIR/etc/heat-metadata.conf $HEAT_METADATA_CONF
110
+    iniset $HEAT_METADATA_CONF DEFAULT debug True
111
+    inicomment $HEAT_METADATA_CONF DEFAULT log_file
112
+    iniset $HEAT_METADATA_CONF DEFAULT use_syslog $SYSLOG
113
+    iniset $HEAT_METADATA_CONF DEFAULT bind_host $HEAT_METADATA_HOST
114
+    iniset $HEAT_METADATA_CONF DEFAULT bind_port $HEAT_METADATA_PORT
115
+
116
+    if is_service_enabled rabbit; then
117
+        iniset $HEAT_METADATA_CONF DEFAULT rpc_backend heat.openstack.common.rpc.impl_kombu
118
+        iniset $HEAT_METADATA_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
119
+        iniset $HEAT_METADATA_CONF DEFAULT rabbit_host $RABBIT_HOST
120
+    elif is_service_enabled qpid; then
121
+        iniset $HEAT_METADATA_CONF DEFAULT rpc_backend heat.openstack.common.rpc.impl_qpid
122
+    fi
123
+
124
+    HEAT_METADATA_PASTE_INI=$HEAT_CONF_DIR/heat-metadata-paste.ini
125
+    cp $HEAT_DIR/etc/heat-metadata-paste.ini $HEAT_METADATA_PASTE_INI
126
+
127
+}
128
+
129
+# init_heat() - Initialize database
130
+function init_heat() {
131
+
132
+    # (re)create heat database
133
+    mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS heat;'
134
+    mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE heat CHARACTER SET utf8;'
135
+
136
+    $HEAT_DIR/bin/heat-db-setup $os_PACKAGE -r $MYSQL_PASSWORD
137
+}
138
+
139
+# install_heat() - Collect source and prepare
140
+function install_heat() {
141
+    git_clone $HEAT_REPO $HEAT_DIR $HEAT_BRANCH
142
+}
143
+
144
+# start_heat() - Start running processes, including screen
145
+function start_heat() {
146
+    screen_it h-eng "cd $HEAT_DIR; bin/heat-engine --config-file=$HEAT_CONF_DIR/heat-engine.conf"
147
+    screen_it h-api "cd $HEAT_DIR; bin/heat-api --config-dir=$HEAT_CONF_DIR/heat-api.conf"
148
+    screen_it h-meta "cd $HEAT_DIR; bin/heat-metadata --config-dir=$HEAT_CONF_DIR/heat-metadata.conf"
149
+}
150
+
151
+# stop_heat() - Stop running processes (non-screen)
152
+function stop_heat() {
153
+    # This function intentionally left blank
154
+    :
155
+}
... ...
@@ -2,7 +2,7 @@
2 2
 
3 3
 # ``stack.sh`` is an opinionated OpenStack developer installation.  It
4 4
 # installs and configures various combinations of **Glance**, **Horizon**,
5
-# **Keystone**, **Nova**, **Quantum** and **Swift**
5
+# **Keystone**, **Nova**, **Quantum**, **Heat** and **Swift**
6 6
 
7 7
 # This script allows you to specify configuration options of what git
8 8
 # repositories to use, enabled services, network configuration and various
... ...
@@ -241,6 +241,7 @@ sudo chown `whoami` $DATA_DIR
241 241
 # Get project function libraries
242 242
 source $TOP_DIR/lib/cinder
243 243
 source $TOP_DIR/lib/ceilometer
244
+source $TOP_DIR/lib/heat
244 245
 
245 246
 # Set the destination directories for openstack projects
246 247
 NOVA_DIR=$DEST/nova
... ...
@@ -787,6 +788,9 @@ if is_service_enabled quantum; then
787 787
     # quantum
788 788
     git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH
789 789
 fi
790
+if is_service_enabled heat; then
791
+    install_heat
792
+fi
790 793
 if is_service_enabled cinder; then
791 794
     install_cinder
792 795
 fi
... ...
@@ -827,6 +831,9 @@ if is_service_enabled quantum; then
827 827
     setup_develop $QUANTUM_CLIENT_DIR
828 828
     setup_develop $QUANTUM_DIR
829 829
 fi
830
+if is_service_enabled heat; then
831
+    configure_heat
832
+fi
830 833
 if is_service_enabled cinder; then
831 834
     configure_cinder
832 835
 fi
... ...
@@ -1945,6 +1952,11 @@ if is_service_enabled mysql && is_service_enabled nova; then
1945 1945
     $NOVA_BIN_DIR/nova-manage db sync
1946 1946
 fi
1947 1947
 
1948
+# Heat
1949
+# ------
1950
+if is_service_enabled heat; then
1951
+    init_heat
1952
+fi
1948 1953
 
1949 1954
 # Launch Services
1950 1955
 # ===============
... ...
@@ -2142,6 +2154,10 @@ screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONF
2142 2142
 is_service_enabled swift3 || \
2143 2143
     screen_it n-obj "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-objectstore"
2144 2144
 
2145
+# launch heat engine, api and metadata
2146
+if is_service_enabled heat; then
2147
+    start_heat
2148
+fi
2145 2149
 
2146 2150
 # Install Images
2147 2151
 # ==============
... ...
@@ -95,6 +95,10 @@ QUANTUM_CLIENT_BRANCH=master
95 95
 TEMPEST_REPO=${GIT_BASE}/openstack/tempest.git
96 96
 TEMPEST_BRANCH=master
97 97
 
98
+# heat service
99
+HEAT_REPO=${GIT_BASE}/heat-api/heat.git
100
+HEAT_BRANCH=master
101
+
98 102
 # Nova hypervisor configuration.  We default to libvirt with **kvm** but will
99 103
 # drop back to **qemu** if we are unable to load the kvm module.  ``stack.sh`` can
100 104
 # also install an **LXC** or **OpenVZ** based system.