###########################################################
# This Blueprint installs the nodecellar application
# on a local machine.
###########################################################

tosca_definitions_version: cloudify_dsl_1_0

imports:
  - http://www.getcloudify.org/spec/cloudify/3.1/types.yaml
  - types/nodecellar.yaml

node_templates:

  host:
    type: cloudify.nodes.Compute
    properties:
      ip: localhost
      install_agent: false

  mongod:
    type: nodecellar.nodes.MongoDatabase
    properties:
      port: 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
      time: 2001-12-14T21:59:43.10-05:00
    relationships:


      - type: node_connected_to_mongo
        target: mongod

      ################################
      # Setting the nodejs connection
      ################################

      - type: node_contained_in_nodejs
        target: test[klkj]

###########################################################
# This outputs section exposes the application endpoint.
# You can access it by running:
#   - cfy deployments -d <deployment_id> outputs
###########################################################

outputs:
  endpoint:
    description: Web application endpoint
    value:
      ip_address: localhost
      port: { get_property: [nodecellar, port] }
