forked from rackspace-orchestration-templates/nodejs-clouddb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode-multi.yaml
334 lines (300 loc) · 8.74 KB
/
node-multi.yaml
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
heat_template_version: 2013-05-23
description: |
Multiple Linux servers with [Node.js 0.10.26](https://nodejs.org/) and a
backend Cloud Database.
parameter_groups:
- label: Server Settings
parameters:
- image
- flavor
- label: Node.js Application Settings
parameters:
- revision
- packages
- repo
- deploy_key
- label: rax-dev-params
parameters:
- destination
- child_template
- load_balancer_hostname
- server_hostnames
- kitchen
- chef_version
parameters:
server_hostnames:
label: Server Name
description: Server Name
type: string
default: nodejs-%index%
constraints:
- length:
min: 1
max: 64
- allowed_pattern: "^[a-zA-Z][a-zA-Z0-9%-]*$"
description: |
Must begin with a letter and contain only alphanumeric characters.
database_username:
label: Database Username
description: Database Username
type: string
default: 'nodejs'
load_balancer_hostname:
label: Load Balancer Hostname
description: Hostname for the Cloud Load Balancer
type: string
default: nodejs-app-load-balancer
constraints:
- length:
min: 1
max: 64
- allowed_pattern: "^[a-zA-Z][a-zA-Z0-9-]*$"
description: |
Must begin with a letter and contain only alphanumeric characters.
nodejs_app_server_count:
label: Server Count
description: |
Required: Number of servers to spin up as a part of this deployment.
type: number
default: 2
constraints:
- range:
min: 1
max: 25
description: Must be between 1 and 25 servers.
image:
label: Operating System
description: |
Required: Server image used for all servers that are created as a part of
this deployment.
type: string
default: Ubuntu 12.04 LTS (Precise Pangolin) (PVHVM)
constraints:
- allowed_values:
- Ubuntu 12.04 LTS (Precise Pangolin) (PVHVM)
description: Must be a supported operating system.
flavor:
label: Server Size
description: |
Required: Rackspace Cloud Server flavor to use. The size is based on the
amount of RAM for the provisioned server.
type: string
default: 4 GB General Purpose v1
constraints:
- allowed_values:
- 1 GB General Purpose v1
- 2 GB General Purpose v1
- 4 GB General Purpose v1
- 8 GB General Purpose v1
- 15 GB I/O v1
- 30 GB I/O v1
- 60 GB I/O v1
- 90 GB Performance
- 512MB Standard Instance
- 1GB Standard Instance
- 2GB Standard Instance
- 4GB Standard Instance
- 8GB Standard Instance
- 15GB Standard Instance
- 30GB Standard Instance
description: |
Must be a valid Rackspace Cloud Server flavor for the region you have
selected to deploy into.
db_flavor:
label: Cloud Database Size
description: |
Required: Rackspace Cloud Database Flavor. Size is based on amount of RAM
for the provisioned instance.
type: string
default: 1GB Instance
constraints:
- allowed_values:
- 512MB Instance
- 1GB Instance
- 2GB Instance
- 4GB Instance
- 8GB Instance
- 16GB Instance
description: |
Must be a valid Rackspace Cloud Database flavor for the region you have
selected to deploy into.
datastore_version:
label: MySQL Version
type: string
description: |
Required: Version of MySQL to run on the Cloud Databases instance.
default: "5.6"
constraints:
- allowed_values:
- "5.6"
- "5.1"
db_size:
label: Database Size
description: |
Required: Amount of storage required for your Rackspace Cloud Database,
in GB.
type: number
default: 10
constraints:
- range:
min: 10
max: 150
description: |
Database instance size, in GB. min 10, max 150
revision:
label: Revision
description: |
Optional: Git Branch/Ref to deploy. Default: HEAD
type: string
default: HEAD
packages:
label: System Packages
description: |
Optional: Additional system packages to install. For a list of available
packages, see: http://packages.ubuntu.com/precise/allpackages
type: string
default: ''
repo:
label: Git Repository
description: |
Optional: URL to your git repository. Use the https:// syntax for public
repositories, use git@ syntax for private repositories.
type: string
default: ''
deploy_key:
label: Git Deploy Key
description: |
Optional: If you specified a private repository, provide your private
deploy key here.
type: string
default: ''
destination:
label: Site Path
description: Path to setup your application on your servers.
default: /var/www/vhosts/application
type: string
kitchen:
label: Kitchen URL
description: URL for the kitchen to use
type: string
default: https://github.com/rackspace-orchestration-templates/nodejs-clouddb
chef_version:
label: Chef Version
description: Version of chef client to use
type: string
default: 11.16.0
child_template:
label: Child Template
description: |
Location of the child template to use for the Node.js web servers
type: string
default: https://raw.githubusercontent.com/rackspace-orchestration-templates/nodejs-clouddb/master/node-web.yaml
resources:
ssh_key:
type: "OS::Nova::KeyPair"
properties:
name: { get_param: "OS::stack_id" }
save_private_key: true
load_balancer:
type: "Rackspace::Cloud::LoadBalancer"
depends_on: nodejs_app_servers
properties:
name:
str_replace:
template: '%lbname%_%stackid%'
params:
'%lbname%': { get_param: load_balancer_hostname }
'%stackid%': { get_param: 'OS::stack_id' }
nodes:
- addresses: { get_attr: [nodejs_app_servers, privateIPv4] }
port: 80
condition: ENABLED
port: 80
healthMonitor:
type: HTTP
delay: 10
timeout: 5
attemptsBeforeDeactivation: 2
path: /
statusRegex: ^[2345]0[0-9]$
protocol: HTTP
algorithm: ROUND_ROBIN
contentCaching: DISABLED
virtualIps:
- type: PUBLIC
ipVersion: IPV4
metadata:
rax-heat: { get_param: "OS::stack_id" }
database_user_password:
type: "OS::Heat::RandomString"
properties:
length: 16
sequence: lettersdigits
db_admin_password:
type: "OS::Heat::RandomString"
properties:
length: 16
sequence: lettersdigits
database_server:
type: OS::Trove::Instance
properties:
name:
str_replace:
template: "nodejs_app_db_%stackid%"
params:
"%stackid%": { get_param: "OS::stack_id" }
flavor: { get_param: db_flavor }
size: { get_param: db_size }
datastore_type: mysql
datastore_version: { get_param: datastore_version }
databases:
- name: nodejs_db
users:
- name: { get_param: database_username }
password: { get_resource: database_user_password }
databases: [ nodejs_db ]
nodejs_app_servers:
type: "OS::Heat::ResourceGroup"
depends_on: database_server
properties:
count: { get_param: nodejs_app_server_count }
resource_def:
type: { get_param: child_template }
properties:
flavor: { get_param: flavor }
hostname: { get_param: server_hostnames }
ssh_key_name: { get_resource: ssh_key }
ssh_private_key: { get_attr: [ssh_key, private_key] }
kitchen: { get_param: kitchen }
chef_version: { get_param: chef_version }
revision: { get_param: revision }
packages: { get_param: packages }
repo: { get_param: repo }
deploy_key: { get_param: deploy_key }
destination: { get_param: destination }
db_server_ip: { get_attr: [database_server, hostname] }
database_username: { get_param: database_username }
database_user_password: { get_resource: database_user_password }
outputs:
load_balancer_ip:
description: Load Balancer IP
value: { get_attr: [load_balancer, PublicIp] }
nodejs_url:
description: "Node.js URL"
value:
str_replace:
template: "http://%ip%"
params:
"%ip%": { get_attr: [load_balancer, PublicIp] }
database_server_ip:
description: Database Server hostname
value: { get_attr: [database_server, hostname] }
mysql_root_password:
description: MySQL Root Password
value: { get_attr: [db_admin_password, value] }
node_server_ips:
description: Node.js Server IPs
value: { get_attr: [nodejs_app_servers, accessIPv4] }
private_key:
description: SSH Private Key
value: { get_attr: [ssh_key, private_key] }