########################################################### # This Blueprint installs the nodecellar application # on an existing host. ########################################################### tosca_definitions_version: cloudify_dsl_1_0 imports: - http://www.getcloudify.org/spec/cloudify/3.2.1/types.yaml - http://www.getcloudify.org/spec/diamond-plugin/1.2.1/plugin.yaml - types/nodecellar.yaml ########################################################### # Inputs section allows the user to use same # blueprint several times, with different paramters for # each time. ########################################################### inputs: host_ip: description: > The ip of the host the application will be deployed on agent_user: description: > User name used when SSH-ing into the started machine agent_private_key_path: description: > Path to a private key that resided on the management machine. SSH-ing into agent machines will be done with this key. node_templates: ########################################################### # We define a type that inherits cloudify's default # compute node, and adds monitoring capabillities # on top of it. ########################################################### host: type: cloudify.nodes.Compute properties: ip: { get_input: host_ip } cloudify_agent: user: { get_input: agent_user } key: { get_input: agent_private_key_path } 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: 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: CPUCollector: {} MemoryCollector: {} LoadAverageCollector: {} DiskUsageCollector: config: devices: x?vd[a-z]+[0-9]*$ NetworkCollector: {} mongod: type: nodecellar.nodes.MongoDatabase properties: port: 27017 interfaces: cloudify.interfaces.lifecycle: ########################################################### # 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 ########################################################### # 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: MongoDBCollector: config: hosts: "localhost:27017" relationships: - type: cloudify.relationships.contained_in target: host nodejs: type: nodecellar.nodes.NodeJSServer relationships: - type: cloudify.relationships.contained_in target: host nodecellar: type: nodecellar.nodes.NodecellarApplicationModule properties: port: 8080 relationships: ################################ # Setting the mongo connection ################################ - type: node_connected_to_mongo target: mongod ################################ # Setting the nodejs connection ################################ - type: node_contained_in_nodejs target: nodejs ########################################################### # This outputs section exposes the application endpoint. # You can access it by running: # - cfy deployments -d outputs ########################################################### outputs: endpoint: description: Web application endpoint value: ip_address: { get_property: [ host, ip ] } port: { get_property: [nodecellar, port] }