forked from cloudify-cosmo/cloudify-nodecellar-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-blueprint.yaml
489 lines (426 loc) · 15.1 KB
/
azure-blueprint.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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
tosca_definitions_version: cloudify_dsl_1_3
description: >
This Blueprint installs the nodecellar application
on an existing host.
imports:
- http://www.getcloudify.org/spec/cloudify/4.3/types.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-azure-plugin/master/plugin.yaml
- http://www.getcloudify.org/spec/diamond-plugin/1.3.6/plugin.yaml
- types/nodecellar.yaml
#####################################################################################
# inputs section allows the user to use same
# blueprint for creating different deployments, each one
# with its own parameters.
# to specify deployment inputs run:
# - cfy deployments create -b <blueprint_id> <deployment_id> -i inputs.json
#####################################################################################
inputs:
resource_prefix:
default: cfy
resource_suffix:
default: 10
# Azure account information
subscription_id:
type: string
required: false
tenant_id:
type: string
required: false
client_id:
type: string
required: false
client_secret:
type: string
required: false
location:
type: string
required: true
default: eastus
retry_after:
type: integer
default: 60
# Existing manager resources
mgr_resource_group_name:
type: string
required: true
mgr_virtual_network_name:
type: string
required: true
mgr_subnet_name:
type: string
required: true
# Virtual Machine information
vm_size:
type: string
required: true
default: Standard_A2
vm_os_family:
type: string
required: true
default: linux
vm_image_publisher:
type: string
required: true
default: Canonical
vm_image_offer:
type: string
required: true
default: UbuntuServer
vm_image_sku:
type: string
required: true
default: 14.04.4-LTS
vm_image_version:
type: string
required: true
default: 14.04.201604060
vm_os_username:
description: >
Username to create as the VM's administrator user
type: string
required: true
default: cloudify
vm_os_password:
description: >
Password to use for the VM's administrator user
type: string
required: true
default: Cl0ud1fy!
vm_os_pubkeys:
description: the public key
default:
- path: {concat:[ '/home/', { get_input: vm_os_username }, '/.ssh/authorized_keys' ]}
keyData:
"ssh-rsa AAAAA3----your-key-here----aabbzz"
vm_os_pubkey_auth_only:
default: true
# Application information
webserver_port:
description: The external web server port
default: 8080
dsl_definitions:
azure_config: &azure_config
subscription_id: { get_input: subscription_id }
tenant_id: { get_input: tenant_id }
client_id: { get_input: client_id }
client_secret: { get_input: client_secret }
node_types:
################################################################
# Blueprint node types.
#
# specific new types for the nodecellar app.
# these types are mapped to scripts that are resposible
# for the lifecycle operation.
################################################################
nodecellar.nodes.MonitoredServer:
derived_from: cloudify.azure.nodes.compute.VirtualMachine
properties:
name:
default: {concat:[{get_input: resource_prefix},vm,{get_input: resource_suffix}]}
location:
default: { get_input: location }
retry_after:
default: { get_input: retry_after }
os_family:
default: { get_input: vm_os_family }
azure_config:
default: *azure_config
resource_config:
default:
hardwareProfile:
vmSize: { get_input: vm_size }
storageProfile:
imageReference:
publisher: { get_input: vm_image_publisher }
offer: { get_input: vm_image_offer }
sku: { get_input: vm_image_sku }
version: { get_input: vm_image_version }
osProfile:
computerName: { get_property: [SELF, name] }
adminUsername: { get_input: vm_os_username }
adminPassword: { get_input: vm_os_password }
linuxConfiguration:
ssh:
publicKeys: { get_input: vm_os_pubkeys }
disablePasswordAuthentication: { get_input: vm_os_pubkey_auth_only }
agent_config:
default:
user: { get_input: vm_os_username }
password: { get_input: vm_os_password }
install_method: remote
interfaces:
###########################################################
# We are infact telling cloudify to install a diamond
# monitoring agent on the server.
#
# (see https://github.com/BrightcoveOS/Diamond)
###########################################################
cloudify.interfaces.monitoring_agent:
install:
implementation: diamond.diamond_agent.tasks.install
inputs:
diamond_config:
default:
interval: 1
start: diamond.diamond_agent.tasks.start
stop: diamond.diamond_agent.tasks.stop
uninstall: diamond.diamond_agent.tasks.uninstall
###########################################################
# Adding some collectors. These collectors are necessary
# for the Cloudify UI to display the deafult metrics.
###########################################################
cloudify.interfaces.monitoring:
start:
implementation: diamond.diamond_agent.tasks.add_collectors
inputs:
collectors_config:
default:
CPUCollector: {}
MemoryCollector: {}
LoadAverageCollector: {}
DiskUsageCollector:
config:
devices: x?vd[a-z]+[0-9]*$
NetworkCollector: {}
###########################################################
# Mongo Database.
#
# Used the data backend for the nodecellar application.
# configurable properties:
# - port
###########################################################
node_templates:
nodecellar:
type: nodecellar.nodes.NodecellarApplicationModule
properties:
port: { get_input: webserver_port }
relationships:
################################
# Setting the mongo connection
################################
- type: node_connected_to_mongo
target: mongod
################################
# Setting the nodejs connection
################################
- type: node_contained_in_nodejs
target: nodejs
mongod:
type: nodecellar.nodes.MonitoredMongoDatabase
relationships:
- type: cloudify.relationships.contained_in
target: mongo_host
nodejs:
type: nodecellar.nodes.NodeJSServer
relationships:
- type: cloudify.relationships.contained_in
target: nodejs_host
mongo_host:
type: nodecellar.nodes.MonitoredServer
properties:
name: {concat:[{get_input: resource_prefix},mongohost,{get_input: resource_suffix}]}
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.connected_to_storage_account
target: storage_account
- type: cloudify.azure.relationships.connected_to_availability_set
target: availability_set
- type: cloudify.azure.relationships.connected_to_nic
target: mongo_host_nic
nodejs_host:
type: nodecellar.nodes.MonitoredServer
properties:
name: {concat:[{get_input: resource_prefix},nodejshost,{get_input: resource_suffix}]}
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.connected_to_storage_account
target: storage_account
- type: cloudify.azure.relationships.connected_to_availability_set
target: availability_set
- type: cloudify.azure.relationships.connected_to_nic
target: nodejs_host_nic
resource_group:
type: cloudify.azure.nodes.ResourceGroup
properties:
name: {concat:[{get_input: resource_prefix},arg,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
storage_account:
type: cloudify.azure.nodes.storage.StorageAccount
properties:
name: {concat:[{get_input: resource_prefix},asa,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
accountType: Standard_LRS
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
virtual_network:
type: cloudify.azure.nodes.network.VirtualNetwork
properties:
resource_group_name: { get_input: mgr_resource_group_name }
name: { get_input: mgr_virtual_network_name }
azure_config: *azure_config
use_external_resource: true
location: { get_input: location }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
subnet:
type: cloudify.azure.nodes.network.Subnet
properties:
resource_group_name: { get_input: mgr_resource_group_name }
name: { get_input: mgr_subnet_name }
azure_config: *azure_config
use_external_resource: true
location: { get_input: location }
relationships:
- type: cloudify.azure.relationships.contained_in_virtual_network
target: virtual_network
network_security_group:
type: cloudify.azure.nodes.network.NetworkSecurityGroup
properties:
name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
securityRules:
- name: njssg_ssh
properties:
description: SSH access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 22
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 102
access: Allow
direction: Inbound
- name: njssg_http
properties:
description: HTTP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: { get_property: [ nodecellar, port ] }
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 103
access: Allow
direction: Inbound
- name: njssg_mongoa
properties:
description: Mongo access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: { get_property: [ mongod, port ] }
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 104
access: Allow
direction: Inbound
- name: njssg_mongob
properties:
description: Mongo API access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 28017
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 105
access: Allow
direction: Inbound
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
availability_set:
type: cloudify.azure.nodes.compute.AvailabilitySet
properties:
name: {concat:[{get_input: resource_prefix},availset,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
mongo_host_nic:
type: cloudify.azure.nodes.network.NetworkInterfaceCard
properties:
name: {concat:[{get_input: resource_prefix},mongohostnic,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.nic_connected_to_network_security_group
target: network_security_group
- type: cloudify.azure.relationships.connected_to_ip_configuration
target: mongo_host_nic_ip_cfg
nodejs_host_nic:
type: cloudify.azure.nodes.network.NetworkInterfaceCard
properties:
name: {concat:[{get_input: resource_prefix},nodejs_host_nic,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.nic_connected_to_network_security_group
target: network_security_group
- type: cloudify.azure.relationships.connected_to_ip_configuration
target: nodejs_host_nic_ip_cfg
mongo_host_nic_ip_cfg:
type: cloudify.azure.nodes.network.IPConfiguration
properties:
name: {concat:[{get_input: resource_prefix},mongo_host_ip_cfg,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
privateIPAllocationMethod: Dynamic
relationships:
- type: cloudify.azure.relationships.ip_configuration_connected_to_subnet
target: subnet
nodejs_host_nic_ip_cfg:
type: cloudify.azure.nodes.network.IPConfiguration
properties:
name: {concat:[{get_input: resource_prefix},nodejs_host_ip_cfg,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
privateIPAllocationMethod: Dynamic
relationships:
- type: cloudify.azure.relationships.ip_configuration_connected_to_subnet
target: subnet
- type: cloudify.azure.relationships.ip_configuration_connected_to_public_ip
target: nodecellar_ip
nodecellar_ip:
type: cloudify.azure.nodes.network.PublicIPAddress
properties:
name: {concat:[{get_input: resource_prefix},nodejs_host_pip,{get_input: resource_suffix}]}
location: { get_input: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
publicIPAllocationMethod: Static
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
###########################################################
# This outputs section exposes the application endpoint.
# You can access it by running:
# - cfy deployments outputs <deployment_id>
###########################################################
outputs:
endpoint:
description: Web application endpoint
value:
ip_address: { get_attribute: [ nodejs_host, public_ip ] }
port: { get_property: [ nodecellar, port ] }