1 heat_template_version: 2013-05-23
4 HEAT template for deploying a multi-node wordpress deployment on Rackspace Cloud
5 using Cloud Servers, Cloud Load Balancers and Cloud Databases. This version uses
6 a user-defined template resource to specify the implementation of the web-heads
11 description: flavor id for the web server instances
13 default: 1GB Standard Instance
16 - 512MB Standard Instance
17 - 1GB Standard Instance
18 - 2GB Standard Instance
19 - 4GB Standard Instance
20 - 8GB Standard Instance
21 - 15GB Standard Instance
22 - 30GB Standard Instance
23 description: must be a valid Rackspace Cloud Server flavor.
26 description: base name for the web server instances
28 default: Wordpress Webserver
31 description: nova keypair to use for ssh access to the web nodes
36 description: the name for the wordpress database
42 description: must be between 1 and 64 characters
43 - allowed_pattern: "[a-zA-Z][a-zA-Z0-9]*"
44 description: must begin with a letter and contain only alphanumeric characters.
49 description: wordpress database admin account username
55 description: must be between 1 and 16 characters
56 - allowed_pattern: "[a-zA-Z][a-zA-Z0-9]*"
57 description: must begin with a letter and contain only alphanumeric characters.
62 description: wordpress database admin account password
68 description: must be between 1 and 14 characters
69 - allowed_pattern: "[a-zA-Z0-9]*"
70 description : must contain only alphanumeric characters.
73 description: wordpress database instance size
83 description: must be a valid cloud database flavor
86 description : wordpress database volume size (in GB)
93 description: must be between 1 and 1024 GB
96 description: the database instance name
101 description: valid domain name
106 description: domain owner email addresses
108 default: admin@example.com
111 description: domain record type
127 type: OS::Heat::ResourceGroup
131 type: Rackspace::Cloud::Server
133 flavor: { get_param: web_node_flavor }
134 image: fd8e4f18-9270-4f43-8932-c3719ae2f7fd # CentOS 6.5
135 name: { get_param: web_server_name }
136 key_name: { get_param: key_name }
141 yum -y install mysql httpd wordpress
142 sed -i "/Deny from All/d" /etc/httpd/conf.d/wordpress.conf
143 sed -i "s/Require local/Require all granted/" /etc/httpd/conf.d/wordpress.conf
144 sed --in-place --e "s/localhost/%dbhost%/" --e "s/database_name_here/%dbname%/" --e "s/username_here/%dbuser%/" --e "s/password_here/%dbpass%/" /usr/share/wordpress/wp-config.php
145 /etc/init.d/httpd start
147 iptables -I INPUT -p tcp --dport 80 -j ACCEPT
148 iptables-save > /etc/sysconfig/iptables
150 "%dbhost%": { get_attr: [ db, hostname ] }
151 "%dbname%": { get_param: db_name }
152 "%dbuser%": { get_param: db_username }
153 "%dbpass%": { get_param: db_password }
156 type: "Rackspace::Cloud::LoadBalancer"
160 template: "lb-%server_name%"
162 "%server_name%": { get_param: web_server_name }
164 - addresses: { get_attr: [ web_nodes, privateIPv4 ] }
169 algorithm: LEAST_CONNECTIONS
173 maxConnectionRate: 50
177 sessionPersistence: HTTP_COOKIE
185 attemptsBeforeDeactivation: 3
189 contentCaching: ENABLED
192 type: OS::Trove::Instance
194 name: { get_param: db_instance_name }
195 flavor: { get_param: db_flavor }
196 size: { get_param: db_volume_size }
198 - name: { get_param: db_username }
199 password: { get_param: db_password }
201 - { get_param: db_name }
203 - name: { get_param: db_name }
206 type: Rackspace::Cloud::DNS
208 name: { get_param: domain_name }
209 emailAddress: { get_param: email_address }
211 - name: { get_param: domain_name }
212 type: { get_param: domain_record_type }
213 data: { get_attr: [lb, PublicIp] }
214 - name: { get_param: domain_name }
216 data: dns1.stabletransit.com
217 - name: { get_param: domain_name }
219 data: dns2.stabletransit.com
227 template: "http://%ip%/wordpress"
229 "%ip%": { get_attr: [ lb, PublicIp ] }
230 description: Public URL for the wordpress blog
232 wordpress_domain_url:
235 template: "http://%domain%/wordpress"
237 "%domain%": { get_param: domain_name }
238 description: Public URL for the wordpress blog with domain name