Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

[![Circle CI](https://circleci.com/gh/cloudify-cosmo/cloudify-hello-world-example/tree/master.svg?&style=shield)](https://circleci.com/gh/cloudify-cosmo/cloudify-hello-world-example/tree/master)

This repository contains a Hello World example blueprint based on OpenStack.
This repository contains Hello World example blueprints, for OpenStack, AWS and existing hosts.

This example creates a VM on OpenStack and starts an HTTP server using a bash script.
All blueprints start an HTTP server on a VM:

* [ec2-blueprint.yaml](ec2-blueprint.yaml) creates a Linux VM on AWS
* [ec2-windows-blueprint.yaml](ec2-windows-blueprint.yaml) creates a Windows VM on AWS
* [openstack-blueprint.yaml](openstack-blueprint.yaml) creates a Linux VM on OpenStack
* [openstack-windows-blueprint.yaml](openstack-windows-blueprint.yaml) creates a Windows VM on OpenStack
* [openstack-windows-winrm-blueprint.yaml](openstack-windows-winrm-blueprint.yaml) creates a Windows VM on OpenStack
* [singlehost-blueprint.yaml](singlehost-blueprint.yaml) creates no infrastructure (installs the app on an existing VM)
* [no-monitoring-singlehost-blueprint.yaml](no-monitoring-singlehost-blueprint.yaml) similar to `singlehost-blueprint.yaml`,
however does not include monitoring configuration

If you're only now starting to work with Cloudify see our [Getting Started Guide](http://docs.getcloudify.org/latest/intro/getting-started/).
90 changes: 0 additions & 90 deletions blueprint.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions include/inputs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
inputs:
webserver_port:
description: >
The HTTP web server port.
default: 8080
29 changes: 29 additions & 0 deletions include/openstack-inputs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
inputs:
keystone_username:
type: string
keystone_password:
type: string
keystone_tenant_name:
type: string
keystone_url:
type: string
region:
type: string
floating_network_name:
description: The name of the network to use for allocating a floating ip
image:
description: Openstack image name or id to use for the new server
flavor:
description: Openstack flavor name or id to use for the new server
network_name:
description: Openstack network name the new server will be connected to
agents_security_group_name:
description: Name of security group that enables access to agent hosts
key_pair_name:
default: 'hello-world'
description: Openstack key pair name of the key to associate with the new server
private_key_path:
default: '~/hw.pem'
description: |
Path to the private key which will be used for connecting to the server
on the manager or machine running CLI if running in local mode.
16 changes: 16 additions & 0 deletions include/scaling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
inputs:
default_scale_count:
type: integer
description: Number of scale units to deploy by default
default: 1

groups:
vm_and_ip:
members: [vm, public_ip]

policies:
scale_policy:
type: cloudify.policies.scaling
properties:
default_instances: { get_input: default_scale_count }
targets: [vm_and_ip]
23 changes: 14 additions & 9 deletions no-monitoring-singlehost-blueprint.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
tosca_definitions_version: cloudify_dsl_1_3

description: >
This blueprint installs a simple web server on the manager VM using Cloudify's script plugin.
This blueprint installs a simple web server on a pre-existing machine. It is similar to the blueprint
"singlehost-blueprint.yaml", except that this one omits the monitoring-related configuration.
IMPORTANT: The VM being used must be associated with a security group (or multiple security groups)
that, cumulatively, allows TCP access via the port specified by the "webserver_port" input (defaults to 8080),
as well as TCP access for the Cloudify Agent installation process.

imports:
- http://www.getcloudify.org/spec/cloudify/4.1m1/types.yaml
- http://www.getcloudify.org/spec/diamond-plugin/1.3.5/plugin.yaml
- include/inputs.yaml

inputs:
server_ip:
description: >
The ip of the server the application will be deployed on.
The ip of the machine that the application will be installed on.
agent_user:
description: >
User name used when SSH-ing into the started machine.
User account used when SSH-ing into the existing machine for the purpose
of Cloudify Agent installation.
agent_private_key_path:
description: >
Path to a private key that resides on the management machine.
SSH-ing into agent machines will be done with this key.
webserver_port:
description: >
The HTTP web server port.
default: 8080
Path to a private key to use when SSH-ing into the existing machine for
agent installation. This path must be available on the machine that is executing the
installation workflow (that is, the Cloudify Manager machine in a managed environment,
or the local machine in a local invocation).

node_templates:
vm:
Expand All @@ -31,6 +35,7 @@ node_templates:
agent_config:
user: { get_input: agent_user }
key: { get_input: agent_private_key_path }

http_web_server:
type: cloudify.nodes.WebServer
properties:
Expand Down
116 changes: 60 additions & 56 deletions openstack-blueprint.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,67 @@
tosca_definitions_version: cloudify_dsl_1_3

description: >
The blueprint describes an OpenStack vm created using Cloudify's OpenStack plugin
and simple web server started using Cloudify's script plugin.
In addition, an OpenStack floating ip and security group are created and associated with the created vm.
The blueprint installs a simple web server on a Linux virtual machine under OpenStack.
Other than a VM, this blueprint creates a keypair, a security group, and a floating IP for the application.
This blueprint assumes that a security group for Cloudify Agents already exists; its name should
be provided for the "agents_security_group" input.

imports:
- http://www.getcloudify.org/spec/cloudify/4.1m1/types.yaml
- http://www.getcloudify.org/spec/openstack-plugin/2.0.1/plugin.yaml
- http://www.getcloudify.org/spec/diamond-plugin/1.3.5/plugin.yaml
- include/openstack-inputs.yaml
- include/inputs.yaml
- include/scaling.yaml

inputs:
webserver_port:
description: The HTTP web server port
default: 8080
agent_user:
description: User name used when SSH-ing into the started machine
image:
description: Openstack image name or id to use for the new server
flavor:
description: Openstack flavor name or id to use for the new server
network_name:
description: Openstack network name the new server will be connected to
floating_network_id:
description: The id of the network to use for allocating a floating ip
key_pair_name:
description: Openstack key pair name of the key to associate with the new server
private_key_path:
description: |
Path to the private key which will be used for connecting to the server
on the manager or machine running CLI if running in local mode.
description: >
User account used when SSH-ing into the existing machine for the purpose
of Cloudify Agent installation.

dsl_definitions:
openstack_configuration: &openstack_configuration
username: { get_input: keystone_username }
password: { get_input: keystone_password }
tenant_name: { get_input: keystone_tenant_name }
auth_url: { get_input: keystone_url }
region: { get_input: region }

node_templates:
virtual_ip:
public_ip:
type: cloudify.openstack.nodes.FloatingIP
properties:
openstack_config: *openstack_configuration
floatingip:
floating_network_id: { get_input: floating_network_id }
floating_network_name: { get_input: floating_network_name }

agents_security_group:
type: cloudify.openstack.nodes.SecurityGroup
properties:
openstack_config: *openstack_configuration
use_external_resource: true
resource_id: { get_input: agents_security_group_name }

security_group:
app_security_group:
type: cloudify.openstack.nodes.SecurityGroup
properties:
openstack_config: *openstack_configuration
rules:
- port: { get_property: [ http_web_server, port ] }
remote_ip_prefix: 0.0.0.0/0
- port: 22
remote_ip_prefix: 0.0.0.0/0

keypair:
type: cloudify.openstack.nodes.KeyPair
properties:
use_external_resource: true
openstack_config: *openstack_configuration
resource_id: { get_input: key_pair_name }
private_key_path: { get_input: private_key_path }

vm:
type: cloudify.openstack.nodes.Server
properties:
openstack_config: *openstack_configuration
agent_config:
user: { get_input: agent_user }
key: { get_property: [ keypair, private_key_path ] }
Expand All @@ -67,42 +72,41 @@ node_templates:
- type: cloudify.openstack.server_connected_to_keypair
target: keypair
- type: cloudify.openstack.server_connected_to_floating_ip
target: virtual_ip
target: public_ip
- type: cloudify.openstack.server_connected_to_security_group
target: agents_security_group
- type: cloudify.openstack.server_connected_to_security_group
target: security_group
target: app_security_group
interfaces:
cloudify.interfaces.lifecycle:
create:
inputs:
args:
security_groups: [{ get_attribute: [ security_group, external_name ]}]
###########################################################
# We are infact telling cloudify to install a diamond
# monitoring agent on the server.
#
# (see https://github.com/BrightcoveOS/Diamond)
###########################################################
# Needed until JIRA issue OPENSTACK-38 is resolved.
security_groups:
- { get_attribute: [ agents_security_group, external_name ]}
- { get_attribute: [ app_security_group, external_name ]}
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
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
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: {}
start:
implementation: diamond.diamond_agent.tasks.add_collectors
inputs:
collectors_config:
CPUCollector: {}
MemoryCollector: {}
LoadAverageCollector: {}
DiskUsageCollector:
config:
devices: x?vd[a-z]+[0-9]*$
NetworkCollector: {}

http_web_server:
type: cloudify.nodes.WebServer
Expand All @@ -120,5 +124,5 @@ node_templates:
outputs:
http_endpoint:
description: Web server external endpoint
value: { concat: ['http://', { get_attribute: [virtual_ip, floating_ip_address] },
value: { concat: ['http://', { get_attribute: [public_ip, floating_ip_address] },
':', { get_property: [http_web_server, port] }] }
Loading