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 for the web server instances
13 default: 4GB Standard Instance
16 - 4GB Standard Instance
17 - 8GB Standard Instance
18 - 15GB Standard Instance
19 - 30GB Standard Instance
20 description: must be a valid Rackspace Cloud Server flavor.
24 default: Windows Server 2012
25 description: Windows Server Image
28 description: base name for the web server instances
30 default: Wordpress Webserver
34 description: the name for the wordpress database
40 description: must be between 1 and 64 characters
41 - allowed_pattern: "[a-zA-Z][a-zA-Z0-9]*"
42 description: must begin with a letter and contain only alphanumeric characters.
47 description: wordpress database admin account username
53 description: must be between 1 and 16 characters
54 - allowed_pattern: "[a-zA-Z][a-zA-Z0-9]*"
55 description: must begin with a letter and contain only alphanumeric characters.
60 description: wordpress database admin account password
66 description: must be between 1 and 14 characters
67 - allowed_pattern: "[a-zA-Z0-9]*"
68 description : must contain only alphanumeric characters.
71 description: wordpress database instance size
81 description: must be a valid cloud database flavor
84 description : wordpress database volume size (in GB)
91 description: must be between 1 and 1024 GB
94 description: the database instance name
101 type: OS::Heat::ResourceGroup
105 type: Rackspace::Cloud::WinServer
107 name: { get_param: web_server_name }
108 flavor: { get_param: web_node_flavor }
109 image: { get_param: image }
113 $source = "http://download.microsoft.com/download/7/0/4/704CEB4C-9F42-4962-A2B0-5C84B0682C7A/WebPlatformInstaller_amd64_en-US.msi"
114 $destination = "webpi.msi"
115 $wc = New-Object System.Net.WebClient
116 $wc.DownloadFile($source, $destination)
117 Start-Process msiexec -ArgumentList "/i webpi.msi /qn" -NoNewWindow -Wait
118 echo "AppPath[@]Default Web Site/wordpress" > wp.app
119 echo "DbServer[@]%dbhost%" >> wp.app
120 echo "DbName[@]%dbname%" >> wp.app
121 echo "DbUsername[@]%dbuser%" >> wp.app
122 echo "DbPassword[@]%dbpassword%" >> wp.app
123 echo "DbAdminUsername[@]%dbuser%" >> wp.app
124 echo "DbAdminPassword[@]%dbpassword%" >> wp.app
125 $tmpprofile = $env:userprofile
126 $env:userprofile = "c:\users\administrator"
127 $wpicmd = "C:\Program Files\Microsoft\Web Platform Installer\WebPICMD.exe"
128 Start-Process $wpicmd -ArgumentList "/Install /Application:Wordpress@wp.app /MySQLPassword:%dbpassword% /AcceptEULA /Log:.\wpi.log" -NoNewWindow -Wait
129 $env:userprofile = $tmpprofile
131 "%dbhost%": { get_attr: [ db, hostname ] }
132 "%dbname%": { get_param: db_name }
133 "%dbuser%": { get_param: db_username }
134 "%dbpassword%": { get_param: db_password }
137 type: "Rackspace::Cloud::LoadBalancer"
141 template: lb-%server_name%
143 "%server_name%": { get_param: web_server_name }
145 - addresses: { get_attr: [ web_nodes, privateIPv4 ] }
150 algorithm: LEAST_CONNECTIONS
154 maxConnectionRate: 50
158 sessionPersistence: HTTP_COOKIE
166 attemptsBeforeDeactivation: 3
170 contentCaching: ENABLED
173 type: OS::Trove::Instance
175 name: { get_param: db_instance_name }
176 flavor: { get_param: db_flavor }
177 size: { get_param: db_volume_size }
179 - name: { get_param: db_username }
180 password: { get_param: db_password }
182 - { get_param: db_name }
184 - name: { get_param: db_name }
191 template: http://%ip%/wordpress
193 "%ip%": { get_attr: [ lb, PublicIp ] }
194 description: Public URL for the wordpress blog