forked from cloudify-cosmo/cloudify-nodecellar-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodecellar.yaml
More file actions
155 lines (134 loc) · 5.28 KB
/
Copy pathnodecellar.yaml
File metadata and controls
155 lines (134 loc) · 5.28 KB
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
################################################################
# Blueprint node types.
#
# specific new types for the nodecellar app.
# these types are mapped to scripts that are resposible
# for the lifecycle operation.
################################################################
node_types:
###########################################################
# Mongo Database.
#
# Used the data backend for the nodecellar application.
# configurable properties:
# - port
###########################################################
nodecellar.nodes.MongoDatabase:
derived_from: cloudify.nodes.DBMS
properties:
port:
description: MongoDB port
type: integer
default: 27017
interfaces:
cloudify.interfaces.lifecycle:
create: scripts/mongo/install-mongo.sh
start: scripts/mongo/start-mongo.sh
stop: scripts/mongo/stop-mongo.sh
nodecellar.nodes.MonitoredMongoDatabase:
derived_from: nodecellar.nodes.MongoDatabase
interfaces:
cloudify.interfaces.lifecycle:
create: scripts/mongo/install-mongo.sh
start: scripts/mongo/start-mongo.sh
###########################################################
# The MongoDBCollector depends on a python library called
# pymongo. We install this library in the 'configure'
# lifecycle hook of this node.
###########################################################
configure: scripts/mongo/install-pymongo.sh
stop: scripts/mongo/stop-mongo.sh
###########################################################
# Notice that this node defines an additional collector
# to collect data on the MongoDB.
###########################################################
cloudify.interfaces.monitoring:
start:
implementation: diamond.diamond_agent.tasks.add_collectors
inputs:
collectors_config:
default:
MongoDBCollector:
config:
hosts: { concat: ['localhost:', { get_property: [ SELF, port ] } ] }
###########################################################
# NodeJS Server.
#
# Used to host the nodecellar application module.
###########################################################
nodecellar.nodes.NodeJSServer:
derived_from: cloudify.nodes.ApplicationServer
interfaces:
cloudify.interfaces.lifecycle:
create: scripts/nodejs/install-nodejs.sh
###########################################################
# Nodecellar application.
#
# This is the actual application source files.
# configurable properties:
# - port
# - application url
# - startup script
###########################################################
nodecellar.nodes.NodecellarApplicationModule:
derived_from: cloudify.nodes.ApplicationModule
properties:
port:
description: Web application port
type: integer
default: 8080
application_url:
description: >
URL to an archive containing the application source.
The archive must contain one top level directory.
default: https://github.com/cloudify-cosmo/nodecellar/archive/master.tar.gz
startup_script:
description: >
This script will be used to start the nodejs application.
The path is relative to the top level single directory inside
the archive
type: string
default: server.js
interfaces:
cloudify.interfaces.lifecycle:
configure: scripts/nodecellar/install-nodecellar-app.sh
start: scripts/nodecellar/start-nodecellar-app.sh
stop: scripts/nodecellar/stop-nodecellar-app.sh
################################################################
# Blueprint relationships.
#
# specific new relationships for the nodecellar app.
# these relationships are mapped to scripts that are resposible
# for the relationship operation.
################################################################
relationships:
###########################################################
# This relationship is responsible for setting the mongo
# host ip on the source node as a runtime property.
#
# This will enable the source node to locate the mongo
# database.
###########################################################
node_connected_to_mongo:
derived_from: cloudify.relationships.connected_to
target_interfaces:
cloudify.interfaces.relationship_lifecycle:
postconfigure:
implementation: scripts/mongo/set-mongo-url.sh
inputs:
mongo_ip_address:
description: >
The ip mongo is deployed on. If empty will be resolved at runtime to mongo\'s host ip.
default: ''
###########################################################
# This relationship is responsible for setting the nodejs
# location on the source node.
#
# This will enable the source node to locate nodejs and
# use it to install depenencies with npm
###########################################################
node_contained_in_nodejs:
derived_from: cloudify.relationships.contained_in
target_interfaces:
cloudify.interfaces.relationship_lifecycle:
preconfigure: scripts/nodejs/set-nodejs-root.sh