########################################################### # This Blueprint installs the nodecellar application # on an openstack cloud environment. ########################################################### tosca_definitions_version: cloudify_dsl_1_0 imports: - http://www.getcloudify.org/spec/cloudify/3.1/types.yaml - http://www.getcloudify.org/spec/openstack-plugin/1.1/plugin.yaml - http://www.getcloudify.org/spec/diamond-plugin/1.1/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 -d -i inputs.json ##################################################################################### inputs: image: description: > Image to be used when launching agent VM's flavor: description: > Flavor of the agent VM's agent_user: description: > User for connecting to agent VM's node_types: ########################################################### # We define a type that inherits openstack's default # server, and adds monitoring capabillities on top of it. ########################################################### nodecellar.nodes.MonitoredServer: derived_from: cloudify.openstack.nodes.Server properties: cloudify_agent: default: user: { get_input: agent_user } server: default: image: { get_input: image } flavor: { get_input: flavor } 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: {} node_templates: mongod_host: type: nodecellar.nodes.MonitoredServer relationships: ########################################################### # Attaching the mongo security group to the mongo host ########################################################### - target: mongod_security_group type: cloudify.openstack.server_connected_to_security_group nodejs_host: type: nodecellar.nodes.MonitoredServer relationships: ########################################################### # Attaching a floating ip to the nodejs host ########################################################### - target: nodecellar_floatingip type: cloudify.openstack.server_connected_to_floating_ip ########################################################### # Attaching the nodecellar security group to # the nodecellar host ########################################################### - target: nodecellar_security_group type: cloudify.openstack.server_connected_to_security_group 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: mongod_host nodejs: type: nodecellar.nodes.NodeJSServer relationships: - type: cloudify.relationships.contained_in target: nodejs_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 ########################################################### # A security group to enable access to the nodejs host # using the port of the nodecellar application. # # This security group will be attached to the nodejs_host ########################################################### nodecellar_security_group: type: cloudify.openstack.nodes.SecurityGroup properties: security_group: name: nodecellar_security_group rules: - remote_ip_prefix: 0.0.0.0/0 port: { get_property: [ nodecellar, port ] } ########################################################### # A security group to enable access to the mongo host # using the port of the mongo node. # # We need this so that the nodecellar application can # comminicate with MongoDB, since they are running on # different hosts. ########################################################### mongod_security_group: type: cloudify.openstack.nodes.SecurityGroup properties: security_group: name: mongod_security_group rules: - remote_ip_prefix: 0.0.0.0/0 port: { get_property: [ mongod, port ] } - remote_ip_prefix: 0.0.0.0/0 port: 28017 ########################################################### # A floating ip to be attached to the nodejs host, since # eventually we want to be able to access it # from any machine, on any network. ########################################################### nodecellar_floatingip: type: cloudify.openstack.nodes.FloatingIP ########################################################### # 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_attribute: [ nodecellar_floatingip, floating_ip_address ] } port: { get_property: [ nodecellar, port ] }