vFW and vDNS support added to azure-plugin
[multicloud/azure.git] / azure / aria / aria-extension-cloudify / src / aria / tests / resources / service-templates / tosca-simple-1.0 / node-cellar / node-cellar.yaml
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # NFV is not used here, but we are using it just to validate the imports
17 tosca_definitions_version: tosca_simple_profile_for_nfv_1_0
18 #tosca_definitions_version: tosca_simple_yaml_1_0
19
20 description: >-
21   Node Cellar TOSCA blueprint.
22   Here is some Unicode: 中國.
23
24 metadata:
25   template_name: node-cellar
26   template_author: ARIA
27   template_version: '1.0.0'
28   aria_version: '0.0'
29
30 imports:
31   - types/openstack.yaml
32   - types/nodejs.yaml
33   - types/mongodb.yaml
34   - types/nginx.yaml
35   - aria-1.0
36
37 dsl_definitions:
38
39   default_openstack_credential: &DEFAULT_OPENSTACK_CREDENTIAL
40     user: openstackadmin
41     token: { concat: [ openstack, 123 ] }
42
43 repositories:
44
45   node_cellar:
46     description: >-
47       The repository for the Node Cellar application and its dependencies.
48     url: https://github.com/ccoenraets/nodecellar/archive/
49     credential:
50       user: guest
51       token: ''
52
53 interface_types:
54
55   Maintenance:
56     derived_from: tosca.interfaces.Root
57     inputs:
58       mode:
59         type: string
60         default: immediate
61         constraints:
62           - valid_values: [ immediate, eventual ]
63         description: >-
64           The mode in which maintenance mode is enabled/disabled.
65     enable:
66       description: >-
67         Enable maintenance mode.
68     disable:
69       description: >-
70         Disable maintenance mode.
71
72 node_types:
73
74   NodeMongoApplication:
75     derived_from: nodejs.Application
76     interfaces:
77       Maintenance:
78         type: Maintenance
79     requirements:
80       - database:
81           capability: tosca.capabilities.Endpoint.Database
82           node: mongodb.Database
83
84 topology_template:
85
86   inputs:
87     openstack_credential:
88       type: openstack.Credential
89       value: *DEFAULT_OPENSTACK_CREDENTIAL
90
91   node_templates:
92
93     # Application
94
95     node_cellar:
96       description: >-
97         Node Cellar Node.js web application.
98       type: NodeMongoApplication
99       artifacts:
100         node_cellar:
101           description: >-
102             The Node Cellar application package.
103           type: os.Archive
104           file: master.zip
105           repository: node_cellar
106           deploy_path: /opt/nodejs/applications/node-cellar
107           properties:
108             unpack_credential:
109               user: gigaspaces
110               token: { get_attribute: [ SELF, tosca_id ] }
111               #token: { get_property: [ SELF, app_endpoint, protocol ] }
112               #token: { get_property: [ HOST, flavor_name ] }
113               #token: { token: [ { get_property: [ HOST, flavor_name ] }, '.', 1 ] }
114               #token: { token: [ 'zero.one|two-three', '.|-', 3 ] }
115       interfaces:
116         Maintenance:
117           inputs:
118             mode: eventual
119           enable: maintenance_node_cellar.sh
120           disable: maintenance_node_cellar.sh
121         Standard:
122           create:
123             implementation:
124               primary: create_node_cellar.sh
125               dependencies:
126                 - "process.args.1 > { get_attribute: [ SELF, tosca_id ] }"
127                 - "process.args.2 > { get_property: [ HOST, flavor_name ] }"
128                 - ssh.user > admin
129                 - ssh.password > '1234'
130                 - ssh.use_sudo > true
131       requirements:
132         - database: node_cellar_database
133       capabilities:
134         app_endpoint:
135           properties:
136             protocol: udp
137             url_path: /nodecellar
138
139     node_cellar_database:
140       description: >-
141         Node Cellar MongoDB database.
142       type: mongodb.Database
143       properties:
144         name: node_cellar
145       artifacts:
146         initial:
147           description: >-
148             The Node Cellar initial database.
149           type: mongodb.DatabaseDump
150           file: node-cellar.json
151           repository: node_cellar
152
153     # Server software
154
155     nodejs:
156       description: >-
157         Node.js instance.
158       type: nodejs.Server
159       requirements:
160         - host: application_host
161       capabilities:
162         data_endpoint:
163           properties:
164             url_path: /app
165       node_filter: # cannot be validated
166         properties:
167           #- flavor_name: { valid_values: [ {concat:[m1,.,small]} ] } # won't work because not validated :/
168           - flavor_name: { valid_values: [ m1.small ] }
169         capabilities:
170           - scalable:
171               properties:
172                 - max_instances: { greater_or_equal: 5 }
173
174     mongodb:
175       description: >-
176         MongoDB instance.
177       type: mongodb.Server
178       requirements:
179         - host:
180             node: openstack.Instance
181             node_filter:
182               properties:
183                 - flavor_name: { valid_values: [ m1.medium, { concat: [ { concat: [ m1, . ] }, large ] } ] }
184                 #- flavor_name: { valid_values: [ m1.medium, m1.large ] }
185               capabilities:
186                 - scalable:
187                     properties:
188                       - max_instances: { greater_or_equal: 5 }
189             relationship:
190               interfaces:
191                 Configure:
192                   target_changed: changed.sh
193
194     nginx:
195       type: nginx.Nginx
196       requirements:
197         - host: loadbalancer_host
198         - feature: loadbalancer
199
200     # Features
201
202     loadbalancer:
203       type: nginx.LoadBalancer
204       properties:
205         algorithm: round-robin
206
207     # Hosts
208
209     loadbalancer_host:
210       description: >-
211         Host for the loadbalancer.
212       type: openstack.Instance
213       properties:
214         flavor_name: m1.small
215         os_users: # map of os.UserInfo
216           root:
217             password: admin123
218       interfaces:
219         Standard:
220           inputs:
221             openstack_credential: { get_input: openstack_credential }
222           configure:
223             implementation:
224               primary: juju > run_charm
225               dependencies:
226                 - charm > loadbalancer
227
228     application_host:
229       copy: loadbalancer_host
230       description: >-
231         Host for applications.
232       properties:
233         flavor_name: m1.small
234         os_users: # map of os.UserInfo
235           nodejs:
236             password: nodejs123
237             groups:
238               - www-data
239       capabilities:
240         scalable:
241           properties:
242             max_instances: 5 # overrides the policy
243
244     data_host:
245       copy: loadbalancer_host
246       description: >-
247         Host for data.
248       properties:
249         flavor_name: m1.large
250         flavor_id: 5d62e82c-924e-4fa9-b1e4-c133867596f7
251         os_users: # map of os.UserInfo
252           mongodb:
253             password: mongo123
254       requirements:
255         - local_storage:
256             node: data_volume
257             relationship:
258               properties:
259                 location: /mnt/volume
260       capabilities:
261         scalable:
262           properties:
263             max_instances: 6 # overrides the policy
264
265     data_volume:
266       type: openstack.Volume
267       properties:
268         size: 10 GB
269       interfaces:
270         Standard:
271           inputs:
272             openstack_credential: { get_input: openstack_credential }
273           create: create_data_volume.sh
274
275   groups:
276
277     node_cellar_group:
278       type: openstack.Secured
279       members:
280         - loadbalancer
281         - application_host
282         - data_host
283       interfaces:
284         Standard:
285           inputs:
286             openstack_credential: { get_input: openstack_credential }
287
288   policies:
289
290     app_scaling:
291       type: aria.Scaling
292       properties:
293         max_instances: 10
294         default_instances: 2
295       targets:
296         - node_cellar
297         - nodejs
298
299     host_scaling:
300       type: openstack.Scaling
301       properties:
302         bandwidth_threshold: 2 GB
303         max_instances: 10
304         default_instances: 2
305       targets: # node templates or groups
306         - node_cellar_group
307
308     juju:
309       description: >-
310         Juju plugin executes charms.
311       type: aria.Plugin
312       properties:
313         version: 1.0
314         enabled: false
315
316     maintenance_on:
317       type: MaintenanceWorkflow
318       properties:
319         enabled: true
320
321     maintenance_off:
322       type: MaintenanceWorkflow
323       properties:
324         enabled: false
325
326   substitution_mappings:
327
328     node_type: tosca.nodes.WebApplication
329     requirements:
330       host: [ node_cellar, host ] # doesn't really make sense; just for testing
331     capabilities:
332       app_endpoint: [ loadbalancer, client ]
333
334   outputs:
335
336     endpoint:
337       description: >-
338         The application endpoint.
339       type: string
340       value: { get_property: [ nodejs, data_endpoint, url_path ] }
341
342 policy_types:
343
344   MaintenanceWorkflow:
345     description: >-
346       Workflow to put all nodes in/out of maintenance mode. For web servers, this will show a "this
347       site is under maintenance and we'll be back soon" web page. Database nodes will then close all
348       client connections cleanly and shut down services.
349     derived_from: aria.Workflow
350     properties:
351       implementation:
352         type: string
353         default: workflows.maintenance
354       enabled:
355         description: >-
356           Whether to turn maintenance mode on or off.
357         type: boolean