update comment in the template
[heat-templates.git] / staging / wordpress-multinode-windows.template
blobc285fb66220bacc42c59796e23504caca1d3766f
1 heat_template_version: 2013-05-23
3 description: |
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
8 parameters:
10   web_node_flavor:
11     description: flavor for the web server instances
12     type: string
13     default: 4GB Standard Instance
14     constraints:
15     - allowed_values:
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.
22   image:
23     type: string
24     default: Windows Server 2012
25     description: Windows Server Image
27   web_server_name:
28     description: base name for the web server instances
29     type: string
30     default: Wordpress Webserver
32   db_name:
33     default: wordpress
34     description: the name for the wordpress database
35     type: string
36     constraints:
37     - length:
38         min: 1
39         max: 64
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.
44   db_username:
45     default: admin
46     hidden: true
47     description: wordpress database admin account username
48     type: string
49     constraints:
50     - length:
51         min: 1
52         max: 16
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.
57   db_password:
58     default: admin
59     hidden: true
60     description: wordpress database admin account password
61     type: string
62     constraints:
63     - length:
64         min: 1
65         max: 41
66       description: must be between 1 and 14 characters
67     - allowed_pattern: "[a-zA-Z0-9]*"
68       description : must contain only alphanumeric characters.
70   db_flavor:
71     description: wordpress database instance size
72     type: string
73     default: 1GB Instance
74     constraints:
75     - allowed_values:
76       - 1GB Instance
77       - 2GB Instance
78       - 4GB Instance
79       - 8GB Instance
80       - 16GB Instance
81       description: must be a valid cloud database flavor 
83   db_volume_size: 
84     description : wordpress database volume size (in GB)
85     type: number
86     default: 30
87     constraints:
88     - range:
89         min: 1
90         max: 1024
91       description: must be between 1 and 1024 GB
93   db_instance_name: 
94     description: the database instance name
95     type: string
96     default: WP_Cloud_DB
98 resources:
100   web_nodes: 
101     type: OS::Heat::ResourceGroup
102     properties:
103       count: 2
104       resource_def:
105         type: Rackspace::Cloud::WinServer
106         properties:
107           name: { get_param: web_server_name }
108           flavor: { get_param: web_node_flavor }
109           image: { get_param: image }
110           user_data:
111             str_replace:
112               template: |
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
130               params:
131                 "%dbhost%": { get_attr: [ db, hostname ] }
132                 "%dbname%": { get_param: db_name }
133                 "%dbuser%": { get_param: db_username }
134                 "%dbpassword%": { get_param: db_password }
136   lb:
137     type: "Rackspace::Cloud::LoadBalancer"
138     properties:
139       name:
140         str_replace:
141           template: lb-%server_name%
142           params:
143             "%server_name%": { get_param: web_server_name }
144       nodes:
145       - addresses: { get_attr: [ web_nodes, privateIPv4 ] }
146         port: 80
147         condition: ENABLED
148       protocol: HTTP
149       halfClosed: False
150       algorithm: LEAST_CONNECTIONS
151       connectionThrottle:
152         maxConnections: 50
153         minConnections: 50
154         maxConnectionRate: 50
155         rateInterval: 50
156       port: 80
157       timeout: 120
158       sessionPersistence: HTTP_COOKIE
159       virtualIps:
160       - type: PUBLIC
161         ipVersion: IPV4
162       healthMonitor:
163         type: HTTP
164         delay: 10
165         timeout: 10
166         attemptsBeforeDeactivation: 3
167         path: "/"
168         statusRegex: "."
169         bodyRegex: "."
170       contentCaching: ENABLED
172   db:
173     type: OS::Trove::Instance
174     properties:
175       name: { get_param: db_instance_name }
176       flavor: { get_param: db_flavor }
177       size: { get_param: db_volume_size }
178       users:
179       - name: { get_param: db_username }
180         password: { get_param: db_password }
181         databases:
182         - { get_param: db_name }
183       databases:
184       - name: { get_param: db_name }
186 outputs:
188   wordpress_url:
189     value: 
190       str_replace:
191         template: http://%ip%/wordpress
192         params:
193           "%ip%": { get_attr: [ lb, PublicIp ] }
194     description: Public URL for the wordpress blog