diff --git a/README.md b/README.md index 93fc0a1..f929beb 100644 --- a/README.md +++ b/README.md @@ -1,153 +1,139 @@ -# Cloudify Nodecellar Example +Cloudify Node Cellar Example +============================ -* Master [![Circle CI](https://circleci.com/gh/cloudify-cosmo/cloudify-nodecellar-example/tree/master.svg?&style=shield)](https://circleci.com/gh/cloudify-cosmo/cloudify-nodecellar-example/tree/master) +[![Circle CI status](https://circleci.com/gh/cloudify-cosmo/cloudify-nodecellar-example/tree/master.svg?&style=shield)](https://circleci.com/gh/cloudify-cosmo/cloudify-nodecellar-example/tree/master) +![Node Cellar local tested](http://img.shields.io/badge/nodecellar--local-tested-green.svg) +![Node Cellar simple manually tested](http://img.shields.io/badge/nodecellar--simple-manually--tested-yellow.svg) +![Node Cellar host pool tested](http://img.shields.io/badge/nodecellar--host--pool-tested-green.svg) +![Node Cellar OpenStack tested](http://img.shields.io/badge/nodecellar--openstack-tested-green.svg) +![Node Cellar OpenStack HAProxy tested](http://img.shields.io/badge/nodecellar--openstack--haproxy--net-tested-green.svg) +![Node Cellar OpenStack Nova tested](http://img.shields.io/badge/nodecellar--openstack--nova--net-tested-green.svg) +![Node Cellar CloudStack manually tested](http://img.shields.io/badge/nodecellar--cloudstack-manually--tested-yellow.svg) +![Node Cellar EC2 tested](http://img.shields.io/badge/nodecellar--aws--ec2-tested-green.svg) +![Node Cellar vCloud tested](http://img.shields.io/badge/nodecellar--vcloud-tested-green.svg) +![Node Cellar vSphere tested](http://img.shields.io/badge/nodecellar--vcloud-tested-green.svg) +![Node Cellar SoftLayer tested](http://img.shields.io/badge/nodecellar--softlayer-tested-green.svg) -![alt text](http://img.shields.io/badge/nodecellar--local-tested-green.svg) -![alt text](http://img.shields.io/badge/nodecellar--aws--ec2-tested-green.svg) -![alt text](http://img.shields.io/badge/nodecellar--openstack-tested-green.svg) -![alt text](http://img.shields.io/badge/nodecellar--openstack--nova--net-tested-green.svg) -![alt text](http://img.shields.io/badge/nodecellar--openstack--haproxy--net-tested-green.svg) -![alt text](http://img.shields.io/badge/nodecellar--singlehost-manually--tested-yellow.svg) -![alt text](http://img.shields.io/badge/nodecellar--softlayer-tested-green.svg) -![alt text](http://img.shields.io/badge/nodecellar--cloudstack-manually--tested-yellow.svg) -![alt text](http://img.shields.io/badge/nodecellar--cloudstack--vpc-manually--tested-yellow.svg) -![alt text](http://img.shields.io/badge/nodecellar--host--pool-tested-green.svg) +This repository contains blueprints for installing +[Node Cellar](http://coenraets.org/blog/2012/10/nodecellar-sample-application-with-backbone-js-twitter-bootstrap-node-js-express-and-mongodb/) +on several cloud and other environments. It is a simple two-node deployment that is useful for learning how to use [Cloudify](http://docs.getcloudify.org/3.4.0/intro/what-is-cloudify/) and how to write blueprints, for testing Cloudify installations, and for testing cloud environments. -This repository contains several blueprints for installing the -[nodecellar](http://coenraets.org/blog/2012/10/nodecellar-sample-application-with-backbone-js-twitter-bootstrap-node-js-express-and-mongodb/) -application.
-Nodecellar example consists of: +In addition to installing the application's resources and dependencies, the blueprints will also install a Cloudify agent that reports statistics and allows a Cloudify Manager to better control the hosts. (The exception is the local blueprint, which does not install the agent.) -- A Mongo Database -- A NodeJS Server -- A Javascript Application +## Quick start using the local blueprint -Before you begin its recommended you familiarize yourself with -[Cloudify Terminology](http://getcloudify.org/guide/3.1/reference-terminology.html). +First [install the Cloudify CLI](http://docs.getcloudify.org/3.4.0/intro/installation/). -The first thing you'll need to do is -[install the Cloudify CLI](http://getcloudify.org/guide/3.1/installation-cli.html). -
-This will let you run the various blueprints. +[The local blueprint](local-blueprint.yaml) allows you to install Node Cellar on your local host. (Note that it does _not_ require nor use a Cloudify Manager.) -**Note:
Documentation about the blueprints content is located inside the blueprint files themselves. -
Presented here are only instructions on how to RUN the blueprints using the Cloudify CLI.** -

-**From now on, all commands will assume that the working directory is the root of this repository.** +### Step 1: Initialize -## Local Blueprint +First, let's initialize your working directory to work with the given blueprint. -[This blueprint](local-blueprint.yaml) allows you to install the nodecellar application on your local machine.
-Let see how this is done: + cfy local init -p local-blueprint.yaml -### Step 1: Initialize +Now, you can run any type of workflow using this blueprint. -`cfy local init -p local-blueprint.yaml`
+### Step 2: Install -This command (as the name suggests) initializes your working directory to work with the given blueprint. -Now, you can run any type of workflows on this blueprint.
+Let's run the `install` workflow: -### Step 2: Install + cfy local execute -w install -Lets run the `install` workflow:
+This command will install all the application components on you local machine. (Everything will be safely installed installed under the `tmp` directory.) Once it's done, you should be able to browse to [http://localhost:8080](http://localhost:8080) and see the application. -`cfy local execute -w install` +### Step 3: Uninstall -This command will install all the application components on you local machine. -(don't worry, its all installed under the `tmp` directory)
-Once its done, you should be able to browse to [http://localhost:8080](http://localhost:8080) and see the application. -
+To uninstall the application we run the `uninstall` workflow: + cfy local execute -w uninstall -### Step 3: Uninstall +## Cloud blueprints -To uninstall the application we run the `uninstall` workflow:
+For pre-provisioned hosts: -`cfy local execute -w uninstall` +- [Simple](simple-blueprint.yaml) - deploy on arbitrary hosts with known IP addresses +- [Host pool](host-pool-blueprint.yaml) - deploy on arbitrary hosts with IP addresses managed by a [Host Pool Service](https://github.com/cloudify-cosmo/cloudify-host-pool-service); see also the [the plugin documentation](http://docs.getcloudify.org/3.4.0/plugins/host-pool/) -## All other blueprints +With provisioning of hosts: -- [EC2 Blueprint](aws-ec2-blueprint.yaml) -- [Openstack Blueprint](openstack-blueprint.yaml) -- [Openstack Nova Net Blueprint](openstack-nova-net-blueprint.yaml) -- [Openstack HAProxy Blueprint](openstack-haproxy-blueprint.yaml) -- [Singlehost Blueprint](singlehost-blueprint.yaml) -- [Softlayer Blueprint](softlayer-blueprint.yaml) -- [CloudStack Blueprint](cloudstack-blueprint.yaml) -- [CloudStack VPC Blueprint](cloudstack-vpc-blueprint.yaml) -- [Host Pool Blueprint](host-pool-blueprint.yaml) - To install this -blueprint, you must have a running [Host Pool Service](https://github.com/cloudify-cosmo/cloudify-host-pool-service) available. More -information can be found [Here](http://getcloudify.org/guide/3.2/plugin-host-pool.html#host-pool-service) +- [OpenStack](openstack-blueprint.yaml) +- [OpenStack HAProxy](openstack-haproxy-blueprint.yaml) +- [OpenStack Nova](openstack-nova-net-blueprint.yaml) +- [Apache CloudStack](cloudstack-blueprint.yaml) +- [Amazon EC2](aws-ec2-blueprint.yaml) +- [VMWare vCloud](vcloud-blueprint.yaml) +- [VMWare vSphere](vsphere-blueprint.yaml) +- [IBM SoftLayer](softlayer-blueprint.yaml) -All of these blueprints allow you to install the nodecellar application on different cloud environments. -Doing this requires first to bootstrap a Cloudify Manager.
+The cloud blueprints require access to a [Cloudify Manager](http://docs.getcloudify.org/3.4.0/intro/cloudify-manager/) instance. You can get one by deploying one of the [ready-to-run images](http://docs.getcloudify.org/3.4.0/manager/manager-images/) or [bootstrapping your own](http://docs.getcloudify.org/3.4.0/manager/bootstrapping/), including on a [local virtual machine](http://docs.getcloudify.org/3.4.0/manager/getting-started/). -### Step 1: Bootstrapping +These blueprints assume a topology of two hosts: -Please refer to [Bootstrapping Cloudify](http://getcloudify.org/guide/3.1/installation-bootstrapping.html) to setup your own Cloudify Manager. -

+- A Node.js server, running the JavaScript application +- A MongoDB instance -Great, now that you have your very own Cloudify Manager, we can work with these blueprints. -
+(The exception is the OpenStack HAProxy blueprint, which adds a third host for HAProxy.) + +### Step 1: Connect to the Cloudify Manager + +Tell the CLI to use the Manager: + + cfy use -t ### Step 2: Upload the blueprint -`cfy blueprints upload -b -p `
+ cfy blueprints upload -b -p ### Step 3: Create a deployment -Every one of these blueprints have inputs, which can be populated for a deployment using input files.
-Example input files are located inside the *inputs* directory.
-Note that these files only contain the **mandatory** inputs, i.e, one's that the blueprint does not define a default value for. +Every one of these blueprints has inputs, which can be populated for a deployment using input files. Templates for such input files are located inside the `inputs` directory. Note that these templates only contain the _mandatory_ inputs, those for which the blueprint does not define a default value. Look inside the blueprints for documentation about additional inputs. -After you filled the input file corresponding to your blueprint, run:
+ cp inputs/ -`cfy deployments create -b -d -i inputs/` +After you filled the input file corresponding to your blueprint, create the deployment: -### Step 4: Install + cfy deployments create -b -d -i -Once the deployment is created, we can start running workflows:
+### Step 4: Install -`cfy executions start -w install -d ` +Once the deployment is created, we can start running workflows: -This process will create all the cloud resources needed for the application:
+ cfy executions start -w install -d -- VM's -- Floating IP's -- Security Groups +This `install` workflow will create all the resources and run all the lifecycles tasks needed for deployment in the environment, including: -and everything else that is needed and declared in the blueprint.
+- Virtual machines +- Floating IP addresses +- Security groups ### Step 5: Verify installation -Once the workflow execution is complete, we can view the application endpoint by running:
+Once the workflow execution is complete, we can view the application endpoint by running: -`cfy deployments outputs -d ` + cfy deployments outputs -d -Hit that URL to see the application running. +One of the outputs should be the application's URL. Browse it to see Node Cellar in action! ### Step 6: Uninstall -Now lets run the `uninstall` workflow. This will uninstall the application, -as well as delete all related resources.
+Now lets run the `uninstall` workflow, which will uninstall the application as well as the resources: -`cfy executions start -w uninstall -d ` + cfy executions start -w uninstall -d ### Step 7: Delete the deployment -Its best to delete deployments we are no longer using, since they take up memory on the management machine. -We do this by running: +It's best to delete deployments we are no longer using, since they take up space on the management machine: -`cfy deployments delete -d ` + cfy deployments delete -d -### Step 8: Tearing down the manager +### Step 8: Tear down the manager -If you have no further use for your Cloudify Manager, you can tear it (and all resources created by the bootstrap process) -by running: +If you have no further use for your Cloudify Manager, you can tear it down (together with the resources created by the bootstrap process) by running: -`cfy teardown -f` + cfy teardown -f -## What's Next +## What's next? -Visit us on the Cloudify community website at [getcloudify.org](http://getcloudify.org) for more guides and tutorials. +Visit the Cloudify community website at [getcloudify.org](http://getcloudify.org) for more guides and tutorials. diff --git a/aws-ec2-blueprint.yaml b/aws-ec2-blueprint.yaml index b823860..f2107f7 100644 --- a/aws-ec2-blueprint.yaml +++ b/aws-ec2-blueprint.yaml @@ -1,8 +1,8 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on an amazon ec2 cloud environment. + This blueprint installs the Node Cellar application + on an Amazon EC2 environment. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -12,26 +12,26 @@ imports: - types/aws-ec2-types.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 +# The 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.yaml ##################################################################################### inputs: image: description: > - Image to be used when launching agent VM's + EC2 AMI for provisioning instances (e.g. ami-29ebb519 for Ubuntu 14.04.1) size: description: > - Flavor of the agent VM's + EC2 instance type for provisioning instances (e.g. m3.medium) agent_user: description: > - User for connecting to agent VM's + Username for SSH connections to instances from Cloudify Manager node_templates: @@ -40,112 +40,118 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs - mongod: - type: nodecellar.nodes.MonitoredMongoDatabase - relationships: - - type: cloudify.relationships.contained_in - target: mongod_host - nodejs: type: nodecellar.nodes.NodeJSServer relationships: + + ################################ + # Contained in nodejs host + ################################ + - type: cloudify.relationships.contained_in target: nodejs_host - mongod_host: - type: nodecellar.nodes.MonitoredServer + mongod: + type: nodecellar.nodes.MonitoredMongoDatabase relationships: - ########################################################### - # Attaching the mongo security group to the mongo host - ########################################################### + ################################ + # Contained in mongod host + ################################ - - type: cloudify.aws.relationships.instance_connected_to_security_group - target: mongod_security_group + - type: cloudify.relationships.contained_in + target: mongod_host + + ############ + # Hosts + ############ nodejs_host: type: nodecellar.nodes.MonitoredServer relationships: ########################################################### - # Attaching a floating ip to the nodejs host + # Attach our public IP address to nodejs host ########################################################### - type: cloudify.aws.relationships.instance_connected_to_elastic_ip target: nodecellar_ip ########################################################### - # Attaching the nodecellar security group to the nodejs host + # Put nodejs host in nodecellar security group ########################################################### - type: cloudify.aws.relationships.instance_connected_to_security_group target: nodecellar_security_group + mongod_host: + type: nodecellar.nodes.MonitoredServer + relationships: + + ########################################################### + # Put mongod host in mongod security group + ########################################################### + + - type: cloudify.aws.relationships.instance_connected_to_security_group + target: mongod_security_group + ########################################################### - # 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. + # Security group to open up the Node.js HTTP port to + # world access. ########################################################### - mongod_security_group: + nodecellar_security_group: type: cloudify.aws.nodes.SecurityGroup properties: - description: Security Group for Mongo VMs + description: Security group for Node Cellar application nodes rules: - ip_protocol: tcp - from_port: { get_property: [ mongod, port ] } - to_port: { get_property: [ mongod, port ] } - cidr_ip: 0.0.0.0/0 - - ip_protocol: tcp - from_port: 28017 - to_port: 28017 + from_port: { get_property: [ nodecellar, port ] } + to_port: { get_property: [ nodecellar, port ] } cidr_ip: 0.0.0.0/0 ########################################################### - # A security group to enable access to the nodejs host - # using the port of the nodejs node. - # - # We need this so that the nodecellar application can - # receive web traffic. + # Security group to open up the MongoDB ports to the + # application hosts. ########################################################### - nodecellar_security_group: + mongod_security_group: type: cloudify.aws.nodes.SecurityGroup properties: - description: Security Group for Nodecellar VMs + description: Security group for MongoDB hosts rules: - ip_protocol: tcp - from_port: { get_property: [ nodecellar, port ] } - to_port: { get_property: [ nodecellar, port ] } + from_port: { get_property: [ mongod, port ] } + to_port: { get_property: [ mongod, port ] } + cidr_ip: 0.0.0.0/0 + - ip_protocol: tcp + from_port: 28017 + to_port: 28017 cidr_ip: 0.0.0.0/0 ########################################################### - # An ip to be attached to the nodejs host, since - # eventually we want to be able to access it - # from any machine, on any network. + # Our public IP address for world access. ########################################################### nodecellar_ip: type: cloudify.aws.nodes.ElasticIP ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### diff --git a/cloudstack-blueprint.yaml b/cloudstack-blueprint.yaml index 4abd28d..ff901f9 100644 --- a/cloudstack-blueprint.yaml +++ b/cloudstack-blueprint.yaml @@ -1,5 +1,9 @@ tosca_definitions_version: cloudify_dsl_1_3 +description: > + This blueprint installs the Node Cellar application + on an Apache CloudStack environment. + imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml - http://www.getcloudify.org/spec/cloudstack-plugin/1.3.1/plugin.yaml @@ -8,42 +12,43 @@ imports: - types/cloudstack-types.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 +# The 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.yaml ##################################################################################### inputs: image: description: > - Image to be used when launching application VMs + CloudStack image ID for provisioning VMs size: description: > - The image size of the application VMs + CloudStack image size for provisioning VMs agent_user: description: > - User for connecting to application VMs + Username for SSH connections to VMs from Cloudify Manager cloudstack_zone: description: > - The CloudStack zone the application will be installed in + The CloudStack zone in which the application will be installed cloudstack_network_service_offering: description: > - The CloudStack serviceoffering of the application network created by the blueprint + The CloudStack service offering for the network management_network_resource_id: description: > - The name of the cloudify management network created during the manager bootstrap process + The Cloudify management network ID + (created when you bootstrap Cloudify Manager on CloudStack) nodecellar_network_resource_id: description: > - The name of the dedicated application network to be created. + The application network ID (to be created) default: nodecellar_network node_templates: @@ -53,51 +58,44 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs - mongod: - type: nodecellar.nodes.MonitoredMongoDatabase - relationships: - - type: cloudify.relationships.contained_in - target: mongod_host - nodejs: type: nodecellar.nodes.NodeJSServer relationships: + + ################################ + # Contained in nodejs host + ################################ + - type: cloudify.relationships.contained_in target: nodejs_host - mongod_host: - type: nodecellar.nodes.MonitoredServer + mongod: + type: nodecellar.nodes.MonitoredMongoDatabase relationships: - ########################################################### - # We need the network to be created before the VM, since - # the VM will attempt to connect to all connected - # network nodes. - ########################################################### - - - type: cloudify.relationships.depends_on - target: nodecellar_network + ################################ + # Contained in mongod host + ################################ - ########################################################### - # We need this relationship in order to retrieve the - # management network id when creating agent VM's - ########################################################### + - type: cloudify.relationships.contained_in + target: mongod_host - - type: cloudify.relationships.connected_to - target: management_network + ############ + # Hosts + ############ nodejs_host: type: nodecellar.nodes.MonitoredServer @@ -129,19 +127,40 @@ node_templates: ########################################################### # We need this relationship in order to retrieve the - # management network id when creating agent VM's + # management network id when creating agent VMs ########################################################### - type: cloudify.relationships.connected_to target: management_network ########################################################### - # Attach the ip to the nodejs host + # Attach our public IP address to nodejs host ########################################################### - type: cloudify.cloudstack.virtual_machine_connected_to_floating_ip target: nodecellar_ip + mongod_host: + type: nodecellar.nodes.MonitoredServer + relationships: + + ########################################################### + # We need the network to be created before the VM, since + # the VM will attempt to connect to all connected + # network nodes. + ########################################################### + + - type: cloudify.relationships.depends_on + target: nodecellar_network + + ########################################################### + # We need this relationship in order to retrieve the + # management network ID when creating agent VMs + ########################################################### + + - type: cloudify.relationships.connected_to + target: management_network + ########################################################### # This node represents the existing management # network created by the bootstrap process. @@ -163,7 +182,6 @@ node_templates: # be the default network for hosts. ########################################################### - nodecellar_network: type: cloudify.cloudstack.nodes.Network properties: @@ -184,7 +202,7 @@ node_templates: - type: ingress protocol: TCP cidr: 0.0.0.0/0 - ports: [{ get_property: [ nodecellar, port ] }] + ports: [ { get_property: [ nodecellar, port ] } ] ########################################################### # Allow outgoing traffic so that hosts can download @@ -194,12 +212,10 @@ node_templates: - type: egress protocol: TCP cidr: 0.0.0.0/0 - ports: [80, 443] + ports: [ 80, 443 ] ########################################################### - # An ip to be attached to the nodejs host, since - # eventually we want to be able to access it - # from any machine, on any network. + # Our public IP address for world access. ########################################################### nodecellar_ip: @@ -214,6 +230,13 @@ node_templates: - type: cloudify.cloudstack.floating_ip_connected_to_network target: nodecellar_network +########################################################### +# The outputs section exposes the application endpoint. +# +# You can access it by running: +# - cfy deployments -d outputs +########################################################### + outputs: endpoint: description: Web application endpoint diff --git a/host-pool-blueprint.yaml b/host-pool-blueprint.yaml index 88d1b47..c41431d 100644 --- a/host-pool-blueprint.yaml +++ b/host-pool-blueprint.yaml @@ -1,9 +1,9 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on hosts from an existing host-pool using the - cloudify-host-pool-plugin. + This blueprint installs the Node Cellar application + on hosts from an existing host pool using the + Cloudify Host Pool plugin. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -12,18 +12,18 @@ imports: - types/host-pool-types.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 +# The 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.yaml ##################################################################################### inputs: host_pool_service_endpoint: description: > - URL to the host pool service that will allocate hosts. + URL of the Cloudify Host Pool service that allocates hosts node_templates: @@ -32,30 +32,44 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs + nodejs: + type: nodecellar.nodes.NodeJSServer + relationships: + + ################################ + # Contained in nodejs host + ################################ + + - type: cloudify.relationships.contained_in + target: nodejs_host + mongod: type: nodecellar.nodes.MongoDatabase relationships: + + ################################ + # Contained in mongod host + ################################ + - type: cloudify.relationships.contained_in target: mongod_host - nodejs: - type: nodecellar.nodes.NodeJSServer - relationships: - - type: cloudify.relationships.contained_in - target: nodejs_host + ############ + # Hosts + ############ nodejs_host: type: nodecellar.nodes.Host @@ -64,7 +78,8 @@ node_templates: type: nodecellar.nodes.Host ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### @@ -74,4 +89,4 @@ outputs: description: Web application endpoint value: ip_address: { get_attribute: [ nodejs_host, public_address ] } - port: { get_property: [nodecellar, port] } + port: { get_property: [ nodecellar, port ] } diff --git a/inputs/cloudstack-vpc.yaml.template b/inputs/cloudstack-vpc.yaml.template deleted file mode 100644 index ea8382e..0000000 --- a/inputs/cloudstack-vpc.yaml.template +++ /dev/null @@ -1,7 +0,0 @@ -image_id: '' -image_size: '' -agent_user: '' -cloudstack_zone: '' -cloudstack_app_network_service_offering: '' -cloudstack_management_network_service_offering: '' -management_network_resource_id: '' diff --git a/inputs/singlehost.yaml.template b/inputs/simple.yaml.template similarity index 51% rename from inputs/singlehost.yaml.template rename to inputs/simple.yaml.template index 5b3c87b..d720018 100644 --- a/inputs/singlehost.yaml.template +++ b/inputs/simple.yaml.template @@ -1,3 +1,5 @@ -host_ip: '' +nodejs_host_ip: '' +mongod_host_ip: '' agent_user: '' agent_private_key_path: '' + diff --git a/local-blueprint.yaml b/local-blueprint.yaml index bcb6781..0efd1b8 100644 --- a/local-blueprint.yaml +++ b/local-blueprint.yaml @@ -1,13 +1,21 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on a local machine. + This blueprint installs the Node Cellar application + on the local host. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml - types/nodecellar.yaml +##################################################################################### +# The 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.yaml +##################################################################################### + inputs: host_ip: @@ -20,31 +28,45 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs - mongod: - type: nodecellar.nodes.MongoDatabase + nodejs: + type: nodecellar.nodes.NodeJSServer relationships: + + ################################ + # Contained in the local host + ################################ + - type: cloudify.relationships.contained_in target: host - nodejs: - type: nodecellar.nodes.NodeJSServer + mongod: + type: nodecellar.nodes.MongoDatabase relationships: + + ################################ + # Contained in the local host + ################################ + - type: cloudify.relationships.contained_in target: host + ############ + # Host + ############ + host: type: cloudify.nodes.Compute properties: @@ -52,7 +74,8 @@ node_templates: install_agent: false ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### @@ -62,4 +85,4 @@ outputs: description: Web application endpoint value: ip_address: localhost - port: { get_property: [nodecellar, port] } + port: { get_property: [ nodecellar, port ] } diff --git a/openstack-blueprint.yaml b/openstack-blueprint.yaml index a7c3a69..aebd03b 100644 --- a/openstack-blueprint.yaml +++ b/openstack-blueprint.yaml @@ -1,8 +1,8 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on an openstack cloud environment. + This blueprint installs the Node Cellar application + on an OpenStack environment. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -12,26 +12,26 @@ imports: - types/openstack-types.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 +# The 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.yaml ##################################################################################### inputs: image: description: > - Image to be used when launching agent VM's + OpenStack image for provisioning VMs flavor: description: > - Flavor of the agent VM's + OpenStack flavor for provisioning VMs agent_user: description: > - User for connecting to agent VM's + Username for SSH connections to VMs from Cloudify Manager node_templates: @@ -40,109 +40,114 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs - mongod: - type: nodecellar.nodes.MonitoredMongoDatabase - relationships: - - type: cloudify.relationships.contained_in - target: mongod_host - nodejs: type: nodecellar.nodes.NodeJSServer relationships: + + ################################ + # Contained in nodejs host + ################################ + - type: cloudify.relationships.contained_in target: nodejs_host - mongod_host: - type: nodecellar.nodes.MonitoredServer + mongod: + type: nodecellar.nodes.MonitoredMongoDatabase relationships: - ########################################################### - # Attaching the mongo security group to the mongo host - ########################################################### + ################################ + # Contained in mongod host + ################################ - - target: mongod_security_group - type: cloudify.openstack.server_connected_to_security_group + - type: cloudify.relationships.contained_in + target: mongod_host + + ############ + # Hosts + ############ nodejs_host: type: nodecellar.nodes.MonitoredServer relationships: ########################################################### - # Attaching an ip to the nodejs host + # Attach our public IP address to nodejs host ########################################################### - target: nodecellar_ip type: cloudify.openstack.server_connected_to_floating_ip ########################################################### - # Attaching the nodecellar security group to - # the nodecellar host + # Put nodejs host in nodecellar security group ########################################################### - target: nodecellar_security_group type: cloudify.openstack.server_connected_to_security_group + mongod_host: + type: nodecellar.nodes.MonitoredServer + relationships: + + ########################################################### + # Put mongod host in mongod security group + ########################################################### + + - target: mongod_security_group + type: cloudify.openstack.server_connected_to_security_group + ########################################################### - # 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. + # Security group to open up the Node.js HTTP port to + # world access. ########################################################### - mongod_security_group: + nodecellar_security_group: type: cloudify.openstack.nodes.SecurityGroup properties: security_group: - name: mongod_security_group + name: nodecellar_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 + port: { get_property: [ nodecellar, port ] } ########################################################### - # A security group to enable access to the nodejs host - # using the port of the nodejs node. - # - # We need this so that the nodecellar application can - # receive web traffic. + # Security group to open up the MongoDB ports to the + # application hosts. ########################################################### - nodecellar_security_group: + mongod_security_group: type: cloudify.openstack.nodes.SecurityGroup properties: security_group: - name: nodecellar_security_group + name: mongod_security_group rules: - remote_ip_prefix: 0.0.0.0/0 - port: { get_property: [ nodecellar, port ] } + port: { get_property: [ mongod, port ] } + - remote_ip_prefix: 0.0.0.0/0 + port: 28017 ########################################################### - # An ip to be attached to the nodejs host, since - # eventually we want to be able to access it - # from any machine, on any network. + # Our public IP address for world access. ########################################################### nodecellar_ip: type: cloudify.openstack.nodes.FloatingIP ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### diff --git a/openstack-haproxy-blueprint.yaml b/openstack-haproxy-blueprint.yaml index 7ea1cf9..d575e28 100644 --- a/openstack-haproxy-blueprint.yaml +++ b/openstack-haproxy-blueprint.yaml @@ -1,8 +1,8 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application behind - an haproxy instance on an openstack cloud environment. + This blueprint installs the Node Cellar application behind + an HAProxy instance on an OpenStack environment. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -13,89 +13,113 @@ imports: - types/haproxy/haproxy.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 +# The 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.yaml ##################################################################################### inputs: image: description: > - Image to be used when launching agent VM's + OpenStack image for provisioning VMs flavor: description: > - Flavor of the agent VM's + OpenStack flavor for provisioning VMs agent_user: description: > - User for connecting to agent VM's + Username for SSH connections to VMs from Cloudify Manager node_templates: + haproxy: + type: nodecellar.nodes.MonitoredHAProxy + properties: + backend_app_port: { get_property: [ nodecellar, port ] } + relationships: + + ######################################## + # Contained in haproxy frontend host + # + # Note: HAProxy installation scripts + # only support Ubuntu hosts + ######################################## + + - target: haproxy_frontend_host + type: cloudify.relationships.contained_in + nodecellar: type: nodecellar.nodes.NodecellarApplicationModule relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs ################################ - # Setting the haproxy connection + # Connected to haproxy node ################################ - type: app_connected_to_haproxy target: haproxy - mongod: - type: nodecellar.nodes.MonitoredMongoDatabase - relationships: - - type: cloudify.relationships.contained_in - target: mongod_host - nodejs: type: nodecellar.nodes.NodeJSServer relationships: + + ################################ + # Contained in nodejs host + ################################ + - type: cloudify.relationships.contained_in target: nodejs_host - ######################################## - # Note: only ubuntu haproxy installation - # is supported. - ######################################## - - haproxy: - type: nodecellar.nodes.MonitoredHAProxy - properties: - backend_app_port: { get_property: [ nodecellar, port ] } + mongod: + type: nodecellar.nodes.MonitoredMongoDatabase relationships: - - target: haproxy_frontend_host - type: cloudify.relationships.contained_in - mongod_host: + ################################ + # Contained in mongod host + ################################ + + - type: cloudify.relationships.contained_in + target: mongod_host + + ############ + # Hosts + ############ + + haproxy_frontend_host: type: nodecellar.nodes.MonitoredServer relationships: ########################################################### - # Attaching the mongo security group to the mongo host + # Attach our public IP address to haproxy frontend host ########################################################### - - target: mongod_security_group - type: cloudify.openstack.server_connected_to_security_group + - type: cloudify.openstack.server_connected_to_floating_ip + target: nodecellar_ip + + ################################################################### + # Put haproxy frontend host in haproxy frontend security group + ################################################################### + + - type: cloudify.openstack.server_connected_to_security_group + target: haproxy_frontend_security_group nodejs_host: type: nodecellar.nodes.MonitoredServer @@ -111,57 +135,42 @@ node_templates: relationships: ########################################################### - # Attaching the nodecellar security group to - # the nodecellar host + # Attach nodejs host to nodecellar security group ########################################################### - target: nodecellar_security_group type: cloudify.openstack.server_connected_to_security_group - haproxy_frontend_host: + mongod_host: type: nodecellar.nodes.MonitoredServer relationships: ########################################################### - # Attaching an ip to the haproxy frontend host - ########################################################### - - - type: cloudify.openstack.server_connected_to_floating_ip - target: nodecellar_ip - - ########################################################### - # Attaching the haproxy frontend security group to - # the haproxy frontend host + # Put mongod host in mongod security group ########################################################### - - type: cloudify.openstack.server_connected_to_security_group - target: haproxy_frontend_security_group + - target: mongod_security_group + type: cloudify.openstack.server_connected_to_security_group ########################################################### - # 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. + # Security group to open up the HAProxy HTTP port and + # statistics port to world access. ########################################################### - mongod_security_group: + haproxy_frontend_security_group: type: cloudify.openstack.nodes.SecurityGroup properties: security_group: - name: mongod_security_group + name: haproxy_frontend_security_group rules: - remote_ip_prefix: 0.0.0.0/0 - port: { get_property: [ mongod, port ] } + port: { get_property: [ haproxy, frontend_port ] } - remote_ip_prefix: 0.0.0.0/0 - port: 28017 + port: { get_property: [ haproxy, statistics_port ] } ########################################################### - # 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 + # Security group to open up the Node.js HTTP port to + # HAProxy hosts. ########################################################### nodecellar_security_group: @@ -174,36 +183,31 @@ node_templates: port: { get_property: [ nodecellar, port ] } ########################################################### - # A security group to enable access to the haproxy frontend - # host using the haproxy frontend_port property. - # In addition, we open the statistics port (9000) of haproxy - # - # This security group will be attached to the - # haproxy_frontend_host + # Security group to open up the MongoDB ports to the + # application hosts. ########################################################### - haproxy_frontend_security_group: + mongod_security_group: type: cloudify.openstack.nodes.SecurityGroup properties: security_group: - name: haproxy_frontend_security_group + name: mongod_security_group rules: - remote_ip_prefix: 0.0.0.0/0 - port: { get_property: [ haproxy, frontend_port ] } + port: { get_property: [ mongod, port ] } - remote_ip_prefix: 0.0.0.0/0 - port: { get_property: [ haproxy, statistics_port ]} + port: 28017 ########################################################### - # An ip to be attached to the haproxy frontend host, since - # eventually we want to be able to access it - # from any machine, on any network. + # Our public IP address for world access. ########################################################### nodecellar_ip: type: cloudify.openstack.nodes.FloatingIP ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### @@ -213,4 +217,4 @@ outputs: description: Web application endpoint value: ip_address: { get_attribute: [ nodecellar_ip, floating_ip_address ] } - port: { get_property: [haproxy, frontend_port] } + port: { get_property: [ haproxy, frontend_port] } diff --git a/openstack-nova-net-blueprint.yaml b/openstack-nova-net-blueprint.yaml index 715f448..863c2cd 100644 --- a/openstack-nova-net-blueprint.yaml +++ b/openstack-nova-net-blueprint.yaml @@ -1,9 +1,9 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on an openstack cloud environment with nova network - (as opposed to neutron network). + This blueprint installs the Node Cellar application + on an OpenStack environment with Nova network + (as opposed to Neutron network). imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -13,26 +13,26 @@ imports: - types/openstack-types.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 +# The 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.yaml ##################################################################################### inputs: image: description: > - Image to be used when launching agent VM's + OpenStack image for provisioning VMs flavor: description: > - Flavor of the agent VM's + OpenStack flavor for provisioning VMs agent_user: description: > - User for connecting to agent VM's + Username for SSH connections to VMs from Cloudify Manager node_templates: @@ -41,14 +41,14 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs @@ -57,50 +57,61 @@ node_templates: mongod: type: nodecellar.nodes.MonitoredMongoDatabase relationships: + + ################################ + # Contained in mongod host + ################################ + - type: cloudify.relationships.contained_in target: mongod_host nodejs: type: nodecellar.nodes.NodeJSServer relationships: - - type: cloudify.relationships.contained_in - target: nodejs_host - mongod_host: - type: nodecellar.nodes.MonitoredServer - relationships: + ################################ + # Contained in nodejs host + ################################ - ########################################################### - # Attaching the mongo security group to the mongo host - ########################################################### + - type: cloudify.relationships.contained_in + target: nodejs_host - - target: mongod_security_group - type: cloudify.openstack.server_connected_to_security_group + ############ + # Hosts + ############ nodejs_host: type: nodecellar.nodes.MonitoredServer relationships: ########################################################### - # Attaching a floating ip to the nodejs host + # Attach our public IP address to nodejs host ########################################################### - target: nodecellar_ip type: cloudify.openstack.server_connected_to_floating_ip ########################################################### - # Attaching the nodecellar security group to - # the nodecellar host + # Put nodejs host in nodecellar security group ########################################################### - target: nodecellar_security_group type: cloudify.openstack.server_connected_to_security_group + mongod_host: + type: nodecellar.nodes.MonitoredServer + relationships: + + ########################################################### + # Put mongod host in mongod security group + ########################################################### + + - target: mongod_security_group + type: cloudify.openstack.server_connected_to_security_group + ########################################################### - # 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 + # Security group to open up the Node.js HTTP port to + # world access. ########################################################### nodecellar_security_group: @@ -113,12 +124,8 @@ node_templates: 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. + # Security group to open up the MongoDB ports to the + # application hosts. ########################################################### mongod_security_group: @@ -133,16 +140,15 @@ node_templates: 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. + # Our public IP address for world access. ########################################################### nodecellar_ip: type: cloudify.openstack.nova_net.nodes.FloatingIP ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### diff --git a/simple-blueprint.yaml b/simple-blueprint.yaml index dd1d85a..dbf0513 100644 --- a/simple-blueprint.yaml +++ b/simple-blueprint.yaml @@ -1,8 +1,8 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on an existing host. + This blueprint installs the Node Cellar application + on hosts with known IP addresses. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -11,27 +11,31 @@ imports: - types/simple-types.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 +# The 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.yaml ##################################################################################### inputs: - host_ip: - description: > - The ip of the host the application will be deployed on + nodejs_host_ip: + description: > + IP address of nodejs_host + + mongod_host_ip: + description: > + IP address of mongod_host agent_user: description: > - User name used when SSH-ing into the started machine + Username for SSH connections to hosts from Cloudify Manager 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. + Path to private key used for SSH connections to hosts + (must be accessible by Cloudify Manager) node_templates: @@ -40,46 +44,64 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod - target_interfaces: - cloudify.interfaces.relationship_lifecycle: - postconfigure: - inputs: - mongo_ip_address: localhost ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs - mongod: - type: nodecellar.nodes.MonitoredMongoDatabase + nodejs: + type: nodecellar.nodes.NodeJSServer relationships: + + ################################ + # Contained in nodejs host + ################################ + - type: cloudify.relationships.contained_in - target: host + target: nodejs_host - nodejs: - type: nodecellar.nodes.NodeJSServer + mongod: + type: nodecellar.nodes.MonitoredMongoDatabase relationships: + + ################################ + # Contained in mongod host + ################################ + - type: cloudify.relationships.contained_in - target: host + target: mongod_host + + ############ + # Hosts + ############ - host: + nodejs_host: type: nodecellar.nodes.MonitoredServer properties: - ip: { get_input: host_ip } - cloudify_agent: + ip: { get_input: nodejs_host_ip } + agent_config: + user: { get_input: agent_user } + key: { get_input: agent_private_key_path } + + mongod_host: + type: nodecellar.nodes.MonitoredServer + properties: + ip: { get_input: mongod_host_ip } + agent_config: user: { get_input: agent_user } key: { get_input: agent_private_key_path } ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### @@ -88,5 +110,6 @@ outputs: endpoint: description: Web application endpoint value: - ip_address: { get_property: [ host, ip ] } + ip_address: { get_property: [ nodejs_host, ip ] } port: { get_property: [ nodecellar, port ] } + diff --git a/softlayer-blueprint.yaml b/softlayer-blueprint.yaml index a1e0925..fd18c8d 100644 --- a/softlayer-blueprint.yaml +++ b/softlayer-blueprint.yaml @@ -1,8 +1,8 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on a softlayer cloud environment. + This blueprint installs the Node Cellar application + on an IBM SoftLayer environment. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -12,19 +12,19 @@ imports: - types/softlayer-types.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 +# The 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.yaml ##################################################################################### inputs: location: description: > - Location of the data center - Default value is the location id of Melbourne 1 + Location of the data center for provisioning VMs; + Default value is 1, for Melbourne default: 449596 domain: @@ -33,26 +33,26 @@ inputs: ram: description: > - Item id of the ram - Default value is the item id of 16 GB + RAM item ID for provisioning VMs; + Default value is the item ID for 16 GB default: 1017 cpu: description: > - Item id of the cpu - Default value is the item id of 4 x 2.0 GHz Cores + CPU item ID for provisioning VMs; + Default value is the item ID for 4 x 2.0 GHz cores default: 859 disk: description: > - Item id of the disk - Default value is the item id of 25 GB (SAN) + Disk item ID for provisioning VMs; + Default value is the item ID for 25 GB (SAN) default: 1178 os: description: > - Item id of the operating system - Default value is the item id of + Operating system ID for provisioning VMs; + Default value is the item ID for Ubuntu Linux 14.04 LTS Trusty Tahr - Minimal Install (64 bit) default: 4668 @@ -63,43 +63,58 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs + nodejs: + type: nodecellar.nodes.NodeJSServer + relationships: + + ################################ + # Contained in nodejs host + ################################ + + - type: cloudify.relationships.contained_in + target: nodejs_host + mongod: type: nodecellar.nodes.MonitoredMongoDatabase relationships: + + ################################ + # Contained in mongod host + ################################ + - type: cloudify.relationships.contained_in target: mongod_host - nodejs: - type: nodecellar.nodes.NodeJSServer - relationships: - - type: cloudify.relationships.contained_in - target: nodejs_host + ############ + # Hosts + ############ - mongod_host: + nodejs_host: type: nodecellar.nodes.MonitoredServer properties: - hostname: mongod + hostname: nodejs - nodejs_host: + mongod_host: type: nodecellar.nodes.MonitoredServer properties: - hostname: nodejs + hostname: mongod ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### diff --git a/types/aws-ec2-types.yaml b/types/aws-ec2-types.yaml index d0ada50..d1b2c08 100644 --- a/types/aws-ec2-types.yaml +++ b/types/aws-ec2-types.yaml @@ -1,8 +1,8 @@ node_types: ########################################################### - # We define a type that inherits ec2's default - # server, and adds monitoring capabillities on top of it. + # We define a type that inherits EC2's default + # server, and adds monitoring capabilities on top of it. ########################################################### nodecellar.nodes.MonitoredServer: @@ -18,7 +18,7 @@ node_types: interfaces: ########################################################### - # We are infact telling cloudify to install a diamond + # We are telling Cloudify to install a Diamond # monitoring agent on the server. # # (see https://github.com/BrightcoveOS/Diamond) diff --git a/types/cloudstack-types.yaml b/types/cloudstack-types.yaml index 964ac49..ee8b97c 100644 --- a/types/cloudstack-types.yaml +++ b/types/cloudstack-types.yaml @@ -1,9 +1,9 @@ node_types: ########################################################### - # We define a type that inherits cloudstack's default + # We define a type that inherits CloudStack's default # virtual machine, and adds monitoring - # capabillities on top of it. + # capabilities on top of it. # # Two things to note here: # @@ -11,7 +11,7 @@ node_types: # as the default value for the management network name. # # This will be used for letting the management machine - # know which ip it should connect to when installing + # know which IP it should connect to when installing # agents. # # - We use our 'nodecellar_network_resource_id' input @@ -25,8 +25,8 @@ node_types: management_network_name: ##################################################### - # This is needed for identification of which nic - # to look for when obtaining the VM ip address + # This is needed for identification of which NIC + # to look for when obtaining the VM IP address ##################################################### default: { get_input: management_network_resource_id } @@ -45,7 +45,7 @@ node_types: interfaces: ########################################################### - # We are infact telling cloudify to install a diamond + # We are telling Cloudify to install a Diamond # monitoring agent on the server. # # (see https://github.com/BrightcoveOS/Diamond) diff --git a/types/nodecellar.yaml b/types/nodecellar.yaml index 7d27b32..c118c3d 100644 --- a/types/nodecellar.yaml +++ b/types/nodecellar.yaml @@ -1,17 +1,19 @@ ################################################################ # Blueprint node types. # -# specific new types for the nodecellar app. -# these types are mapped to scripts that are resposible +# Specific new types for the Node Cellar application. +# +# These types are mapped to scripts that are responsible # for the lifecycle operation. ################################################################ node_types: ########################################################### - # Mongo Database. + # MongoDB. + # + # Used as the data backend for the Node Cellar application. # - # Used the data backend for the nodecellar application. # configurable properties: # - port ########################################################### @@ -38,7 +40,7 @@ node_types: ########################################################### # The MongoDBCollector depends on a python library called - # pymongo. We install this library in the 'configure' + # PyMongo. We install this library in the 'configure' # lifecycle hook of this node. ########################################################### @@ -46,7 +48,7 @@ node_types: stop: scripts/mongo/stop-mongo.sh ########################################################### - # Notice that this node defines an additional collector + # Note that this node defines an additional collector # to collect data on the MongoDB. ########################################################### @@ -58,12 +60,12 @@ node_types: default: MongoDBCollector: config: - hosts: { concat: ['localhost:', { get_property: [ SELF, port ] } ] } + hosts: { concat: [ 'localhost:', { get_property: [ SELF, port ] } ] } ########################################################### - # NodeJS Server. + # Node.js server. # - # Used to host the nodecellar application module. + # Used to host the Node Cellar application module. ########################################################### nodecellar.nodes.NodeJSServer: @@ -74,9 +76,10 @@ node_types: ########################################################### - # Nodecellar application. + # Node Cellar application. + # + # These are the actual application source files. # - # This is the actual application source files. # configurable properties: # - port # - application url @@ -97,9 +100,9 @@ node_types: default: https://github.com/cloudify-cosmo/nodecellar/archive/master.tar.gz startup_script: description: > - This script will be used to start the nodejs application. + This script will be used to start the Node.js application. The path is relative to the top level single directory inside - the archive + the archive. type: string default: server.js interfaces: @@ -111,19 +114,20 @@ node_types: ################################################################ # Blueprint relationships. # -# specific new relationships for the nodecellar app. -# these relationships are mapped to scripts that are resposible +# Specific new relationships for the Node Cellar application. +# +# These relationships are mapped to scripts that are responsible # for the relationship operation. ################################################################ relationships: ########################################################### - # This relationship is responsible for setting the mongo - # host ip on the source node as a runtime property. + # This relationship is responsible for setting the MongoDB + # host IP on the source node as a runtime property. # - # This will enable the source node to locate the mongo - # database. + # This will enable the source node to locate the MongoDB + # instance. ########################################################### node_connected_to_mongo: @@ -135,16 +139,14 @@ relationships: inputs: mongo_ip_address: description: > - The ip mongo is deployed on. If empty will be resolved at runtime to mongo\'s host ip. + The IP MongoDB is deployed on. If empty will be resolved at runtime to MongoDB\'s host IP. default: '' - - ########################################################### - # This relationship is responsible for setting the nodejs + # This relationship is responsible for setting the Node.js # location on the source node. # - # This will enable the source node to locate nodejs and + # This will enable the source node to locate Node.js and # use it to install depenencies with npm ########################################################### diff --git a/types/openstack-types.yaml b/types/openstack-types.yaml index 8fc90cb..26aac59 100644 --- a/types/openstack-types.yaml +++ b/types/openstack-types.yaml @@ -2,8 +2,8 @@ node_types: ########################################################### - # We define a type that inherits openstack's default - # server, and adds monitoring capabillities on top of it. + # We define a type that inherits OpenStack's default + # server, and adds monitoring capabilities on top of it. ########################################################### nodecellar.nodes.MonitoredServer: @@ -19,7 +19,7 @@ node_types: interfaces: ########################################################### - # We are infact telling cloudify to install a diamond + # We are telling Cloudify to install a Diamond # monitoring agent on the server. # # (see https://github.com/BrightcoveOS/Diamond) diff --git a/types/simple-types.yaml b/types/simple-types.yaml index 8aae09c..7d6e9bf 100644 --- a/types/simple-types.yaml +++ b/types/simple-types.yaml @@ -1,12 +1,17 @@ node_types: + ########################################################### + # We define a type that inherits Cloudify's default + # server, and adds monitoring capabilities on top of it. + ########################################################### + nodecellar.nodes.MonitoredServer: derived_from: cloudify.nodes.Compute interfaces: ########################################################### - # We are infact telling cloudify to install a diamond + # We are telling Cloudify to install a Diamond # monitoring agent on the server. # # (see https://github.com/BrightcoveOS/Diamond) diff --git a/types/softlayer-types.yaml b/types/softlayer-types.yaml index 218a453..ed79c3e 100644 --- a/types/softlayer-types.yaml +++ b/types/softlayer-types.yaml @@ -2,8 +2,8 @@ node_types: ########################################################### - # We define a type that inherits softlayer's default - # server, and adds monitoring capabillities on top of it. + # We define a type that inherits SoftLayer's default + # server, and adds monitoring capabilities on top of it. ########################################################### nodecellar.nodes.MonitoredServer: @@ -25,7 +25,7 @@ node_types: interfaces: ########################################################### - # We are infact telling cloudify to install a diamond + # We are telling Cloudify to install a Diamond # monitoring agent on the server. # # (see https://github.com/BrightcoveOS/Diamond) diff --git a/types/vcloud-types.yaml b/types/vcloud-types.yaml index 480b7c5..f5b7f1e 100644 --- a/types/vcloud-types.yaml +++ b/types/vcloud-types.yaml @@ -1,8 +1,8 @@ node_types: ########################################################### - # We define a type that inherits vcloud's default - # server, and adds monitoring capabillities on top of it. + # We define a type that inherits vCloud's default + # server, and adds monitoring capabilities on top of it. ########################################################### nodecellar.nodes.MonitoredServer: @@ -24,7 +24,7 @@ node_types: interfaces: ########################################################### - # We are infact telling cloudify to install a diamond + # We are telling Cloudify to install a Diamond # monitoring agent on the server. # # (see https://github.com/BrightcoveOS/Diamond) diff --git a/types/vsphere-types.yaml b/types/vsphere-types.yaml index 421d51d..807186f 100644 --- a/types/vsphere-types.yaml +++ b/types/vsphere-types.yaml @@ -2,8 +2,8 @@ node_types: ########################################################### - # We define a type that inherits vcloud's default - # server, and adds monitoring capabillities on top of it. + # We define a type that inherits vCloud's default + # server, and adds monitoring capabilities on top of it. ########################################################### nodecellar.nodes.MonitoredServer: @@ -30,7 +30,7 @@ node_types: interfaces: ########################################################### - # We are infact telling cloudify to install a diamond + # We are telling Cloudify to install a Diamond # monitoring agent on the server. # # (see https://github.com/BrightcoveOS/Diamond) diff --git a/vcloud-blueprint.yaml b/vcloud-blueprint.yaml index 1f8944f..62976e8 100644 --- a/vcloud-blueprint.yaml +++ b/vcloud-blueprint.yaml @@ -1,8 +1,8 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on an vcloud environment. + This blueprint installs the Node Cellar application + on a VMWare vCloud environment. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -12,21 +12,23 @@ imports: - types/vcloud-types.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 +# The 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.yaml ##################################################################################### inputs: template: type: string + description: > + vCloud template for provisioning servers agent_user: description: > - User for connecting to agent VM's + Username for SSH connections to servers from Cloudify Manager type: string default: ubuntu @@ -39,12 +41,12 @@ inputs: server_cpu: default: 2 description: > - cpu count for each server + CPU count for provisioning servers server_memory: default: 4096 description: > - memory amount for each server + Memory in MB for provisioning servers edge_gateway: type: string @@ -55,7 +57,7 @@ inputs: management_network_name: description: > - Name of the existing network that's being used for Cloudify management + Name of the existing network with access to Cloudify Manager type: string node_templates: @@ -67,14 +69,14 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs @@ -83,6 +85,11 @@ node_templates: nodejs: type: nodecellar.nodes.NodeJSServer relationships: + + ################################ + # Contained in nodejs host + ################################ + - type: cloudify.relationships.contained_in target: nodejs_host @@ -90,12 +97,21 @@ node_templates: type: nodecellar.nodes.MongoDatabase properties: port: 27017 + relationships: + + ################################ + # Contained in mongod host + ################################ + + - type: cloudify.relationships.contained_in + target: mongod_host + interfaces: cloudify.interfaces.lifecycle: ########################################################### # The MongoDBCollector depends on a python library called - # pymongo. We install this library in the 'configure' + # PyMongo. We install this library in the 'configure' # lifecycle hook of this node. ########################################################### @@ -114,39 +130,58 @@ node_templates: MongoDBCollector: config: hosts: "localhost:27017" - relationships: - - type: cloudify.relationships.contained_in - target: mongod_host + + ############ + # Hosts + ############ nodejs_host: type: nodecellar.nodes.MonitoredServer relationships: ########################################################### - # Attaching a floating ip to the nodejs host + # Attach our public IP address to nodejs host ########################################################### - target: nodecellar_ip type: cloudify.vcloud.server_connected_to_floating_ip + + ########################################################### + # Use key pair for SSH connections + ########################################################### + - target: ssh_keypair type: cloudify.vcloud.server_connected_to_keypair + + ########################################################### + # Put nodejs host in nodejs security group + ########################################################### + - target: nodejs_security_group type: cloudify.vcloud.server_connected_to_security_group mongod_host: type: nodecellar.nodes.MonitoredServer relationships: - - target: ssh_keypair - type: cloudify.vcloud.server_connected_to_keypair + + ########################################################### + # Put mongod host in mongod security group + ########################################################### + - target: mongod_security_group type: cloudify.vcloud.server_connected_to_security_group - ssh_keypair: - type: cloudify.vcloud.nodes.KeyPair - properties: - public_key: - user: { get_input: agent_user } - key: { get_input: agent_public_key } + ########################################################### + # Use key pair for SSH connections + ########################################################### + + - target: ssh_keypair + type: cloudify.vcloud.server_connected_to_keypair + + ########################################################### + # Security group to open up the Node.js HTTP port to + # world access. Also opens up backward access. + ########################################################### nodejs_security_group: type: cloudify.vcloud.nodes.SecurityGroup @@ -160,15 +195,20 @@ node_templates: destination_port: 8080 action: allow description: > - http to nodejs node + Open HTTP port protocol: TCP - source: host destination: any action: allow description: > - backward network connection for nodejs updates + Backward network connection protocol: any + ########################################################### + # Security group to open up the MongoDB ports to the + # application hosts. Also opens up backward access. + ########################################################### + mongod_security_group: type: cloudify.vcloud.nodes.SecurityGroup properties: @@ -180,13 +220,11 @@ node_templates: destination: any action: allow description: > - backward network connection for mongod updates + Backward network connection protocol: any ########################################################### - # 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. + # Our public IP address for world access. ########################################################### nodecellar_ip: @@ -195,8 +233,20 @@ node_templates: floatingip: edge_gateway: { get_input: edge_gateway } + ########################################################### + # Key pair for SSH connections + ########################################################### + + ssh_keypair: + type: cloudify.vcloud.nodes.KeyPair + properties: + public_key: + user: { get_input: agent_user } + key: { get_input: agent_public_key } + ########################################################### -# This outputs section exposes the application endpoint. +# The outputs section exposes the application endpoint. +# # You can access it by running: # - cfy deployments -d outputs ########################################################### diff --git a/vsphere-blueprint.yaml b/vsphere-blueprint.yaml index f5c2bad..92505c1 100644 --- a/vsphere-blueprint.yaml +++ b/vsphere-blueprint.yaml @@ -1,8 +1,8 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - This Blueprint installs the nodecellar application - on an vsphere environment. + This blueprint installs the Node Cellar application + on a VMWare vSphere environment. imports: - http://www.getcloudify.org/spec/cloudify/3.4m5/types.yaml @@ -12,30 +12,30 @@ imports: - types/vsphere-types.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 +# The 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.yaml ##################################################################################### inputs: template_name: description: > - Template to clone VMs from + vSphere template for provisioning servers agent_user: description: > - User for connecting to application VMs + Username for SSH connections to servers from Cloudify Manager management_network: description: > - Which network to deploy the VM on + Name of the existing network with access to Cloudify Manager external_network: description: > - Which network to deploy the VM on + Name of existing network with public access node_templates: @@ -44,37 +44,58 @@ node_templates: relationships: ################################ - # Setting the mongo connection + # Connected to mongod node ################################ - type: node_connected_to_mongo target: mongod ################################ - # Setting the nodejs connection + # Contained in nodejs node ################################ - type: node_contained_in_nodejs target: nodejs + nodejs: + type: nodecellar.nodes.NodeJSServer + relationships: + + ################################ + # Contained in nodejs host + ################################ + + - type: cloudify.relationships.contained_in + target: nodejs_host + mongod: type: nodecellar.nodes.MonitoredMongoDatabase relationships: + + ################################ + # Contained in mongod host + ################################ + - type: cloudify.relationships.contained_in target: mongod_host - nodejs: - type: nodecellar.nodes.NodeJSServer - relationships: - - type: cloudify.relationships.contained_in - target: nodejs_host + ############ + # Hosts + ############ - mongod_host: + nodejs_host: type: nodecellar.nodes.MonitoredServer - nodejs_host: + mongod_host: type: nodecellar.nodes.MonitoredServer +########################################################### +# The outputs section exposes the application endpoint. +# +# You can access it by running: +# - cfy deployments -d outputs +########################################################### + outputs: endpoint: