You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by Graeme-Miller <gi...@git.apache.org> on 2015/11/25 19:59:04 UTC

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

GitHub user Graeme-Miller opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070

    Added some advanced YAML examples

    Added some advanced YAML examples and made a CollectionFunctionals constructor public

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Graeme-Miller/incubator-brooklyn add_advanced_yaml_example

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/1070.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1070
    
----
commit 4ce39902dc8032e4b56df6ddf836e77f389c287d
Author: Graeme-Miller <gr...@cloudsoftcorp.com>
Date:   2015-11-25T18:57:32Z

    Added some advanced YAML examples and made a CollectionFunctionals constructor public

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r45966775
  
    --- Diff: docs/guide/yaml/advanced-example.md ---
    @@ -0,0 +1,177 @@
    +---
    +title: YAML BLueprint Advanced Example
    +layout: website-normal
    +---
    +
    +By this point you should be familiar with the fundamental concepts behind both Apache Brooklyn and YAML blueprints. This section of the documentation is intended to show a complete, advanced example of a YAML blueprint.
    +
    +The intention is that this example is used to learn the more in-depth concepts, but also to serve as a reference point when writing your own blueprints. This page will first exaplin what the example is and how to run it, then it will spotlight interesting features.
    --- End diff --
    
    `exaplin`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r45970035
  
    --- Diff: docs/guide/yaml/advanced-example.md ---
    @@ -0,0 +1,177 @@
    +---
    +title: YAML BLueprint Advanced Example
    +layout: website-normal
    +---
    +
    +By this point you should be familiar with the fundamental concepts behind both Apache Brooklyn and YAML blueprints. This section of the documentation is intended to show a complete, advanced example of a YAML blueprint.
    +
    +The intention is that this example is used to learn the more in-depth concepts, but also to serve as a reference point when writing your own blueprints. This page will first exaplin what the example is and how to run it, then it will spotlight interesting features.
    +
    +
    +### The Example
    +
    +The example itself is a deployment of an ELK stack. ELK stands for Elasticsearch, Logstash and Kibana- and this blueprint deploys, installs, runs and manages all three. Briefly, the component parts are:
    +
    +* Elasticsearch: A clustered search engine
    +* Logstash: Collects, parses and stores logs. For our application it will store logs in Elasticsearch
    +* Kibana: A front end to Elasticsearch
    +
    +For more about the ELK stack, please see the documentation [here](https://www.elastic.co/webinars/introduction-elk-stack).
    +
    +In our example, we will be creating the ELK stack, and a Tomcat8 server which sends its logs using Logstash to Elasticsearch.
    +
    +#### The Blueprints
    +-----------
    +
    +There are four blueprints that make up this application. Each of them are used to add one or more catalog items to Brooklyn. You can find them below:
    +
    +* [Elasticsearch](example_yaml/brooklyn-elasticsearch-catalog.bom)
    +* [Logstash](example_yaml/brooklyn-logstash-catalog.bom)
    +* [Kibana](example_yaml/brooklyn-kibana-catalog.bom)
    +* [ELK](example_yaml/brooklyn-elk-catalog.bom)
    +
    +#### Running the example
    +First, add all four blueprints to the Brooklyn Catalog. This can be done by clicking the 'Catalog' tab, clinking the '+' symbol and pasting the YAML. Once this is done , click the 'Application' then the '+' button to bring up the add application wizard. A new Catalog item will be available called 'ELK Stack'. Using the add application wizard, you should be able to deploy an ELK stack to a location of your choosing.
    +
    +#### Exploring the example
    +After the example has been deployed, you can ensure it is working as expected by checking the following:
    +
    +* There is a Kibana sensor called "main.uri", the value of which points to the Kibana front end. You can explore this front end, and observe the logs stored in Elasticsearch. Many Brooklyn applications have a "main.uri" set to point you in the right direction.
    +* You can also use the Elasticsearch REST API to explore further. The ES entity has an "urls.http.list" sensor. Choosing an url from there you will be able to access the REST API. The following URL will give you the state of the cluster "{es-url}/\_cluster/health?pretty=true". As you can see the number_of_nodes is currently 2, indicating that the Elasticsearch nodes are communicating with each other.
    +
    +### Interesting Feature Spotlight
    +We will mainly focus on the Elasticsearch blueprint, and will be clear when another blueprint is being discussed. This blueprint is a cluster of Elasticsearch nodes. Clustering is a useful technique that is explained in more depth [here](../clusters.html).
    +
    +#### Provisioning Properties
    +Our Elasticsearch blueprint has a few requirements of the location in which it is run. Firstly, it must be run on an Ubuntu machine to simplify installation. Secondly, there are two ports that need to be opened to ensure that the entities can be accessed from the outside world. These are configured on the provisioning.properties as follows:
    +
    +~~~yaml
    +provisioning.properties:
    +  osFamily: ubuntu
    +  inboundPorts:
    +    - $brooklyn:config("elasticsearch.http.port")
    +    - $brooklyn:config("elasticsearch.tcp.port")
    +~~~
    +
    +#### VanillaSoftwareProcess
    +When composing a YAML blueprint, the VanillaSoftwareProcess is a very useful entity to be aware of. A VanillaSoftwareProcess will instruct Brooklyn to provision an instance, and run a series of shell commands to setup, run, monitor and teardown your program. The commands are specified as configuration on the VanillaSoftwareProcess and there are several available. We will spotlight a few now. To simplify this blueprint, we have specified ubuntu only installs so that our commands can be tailored to this system (E.G. use apt-get rather than YUM).
    +
    +##### Customize Command
    +The Customize Command is run after the application has been installed but before it is run. It is the perfect place to create and amend config files. Please refer to the following section of the Elasticsearch blueprint:
    +
    +~~~yaml
    +customize.command: |
    +  $brooklyn:formatString("
    +  sudo rm -fr sudo tee /etc/elasticsearch/elasticsearch.yml;
    +  echo discovery.zen.ping.multicast.enabled: false | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  echo discovery.zen.ping.unicast.enabled: true | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  echo 'discovery.zen.ping.unicast.hosts: %s' | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  echo http.port: %s | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  echo transport.tcp.port: %s | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  ",
    +  $brooklyn:component("parent", "").attributeWhenReady("urls.tcp.withBrackets"),
    +  $brooklyn:config("elasticsearch.http.port"),
    +  $brooklyn:config("elasticsearch.tcp.port")
    +  )
    +~~~
    +The purpose of this section is to create a YAML file with all of the required configuration. We use the YAML literal style "|" indicator to write a multi line command. We then use $brooklyn:formatString notation to build the string from configuration. We start our series of commands by using the "rm" command to remove the previous config file. We then use "echo" and "tee" to create the new config file and insert the config. Part of the configuration is a list of all hosts that is set on the parent entity- this is done by using a combination of the "component" and  "attributeWhenReady" DSL commands. More on how this is generated later.
    +
    +##### Check running
    +After an app is installed and run, this command will be run regularly and used to populate the "service.isUp" sensor. If this command is not specified, or returns an exit code of anything other than zero, then Brooklyn will assume that your entity is broken and will display the fire status symbol. Please refer to the following section of the Elasticsearch blueprint:
    +
    +~~~yaml
    +checkRunning.command: |
    +  $brooklyn:formatString("counter=`wget -T 15 -q -O- %s:%s | grep -c \"status. : 200\"`; if [ $counter -eq 0 ]; then exit 1; fi",
    +  $brooklyn:attributeWhenReady("host.address"),
    +  $brooklyn:config("elasticsearch.http.port"))
    +~~~
    +There are many different ways to implement this command. For this example, we are querying the REST API to get the status. This command creates a variable called counter, and populates it by performing a "WGET" call to the status URL or the Elasticsearch node, grepping for a 200 status OK code. We then check the counter is populated (I.E. that the end point does return status 200) and exit with an error code of one if not.
    +
    +#### Enrichers
    +
    +##### Elasticsearch URLS
    +To ensure that all Elasticsearch nodes can communicate with each other they need to be configured with the TCP URL of all other nodes. Similarly, the Logstash instances need to be configured with all the HTTP URLs of the Elasticsearch nodes. The mechanism for doing this is the same, and involves using Transformers, Aggregators and Joiners, as follows:
    +
    +~~~yaml
    +brooklyn.enrichers:
    +  - type: org.apache.brooklyn.enricher.stock.Transformer
    +    brooklyn.config:
    +      enricher.sourceSensor: $brooklyn:sensor("host.address")
    +      enricher.targetSensor: $brooklyn:sensor("url.tcp")
    +      enricher.targetValue: $brooklyn:formatString("%s:%s", $brooklyn:attributeWhenReady("host.address"), $brooklyn:config("elasticsearch.tcp.port"))  
    +~~~
    +
    +In this example, we take the host.address and append the TCP port, outputting the result as url.tcp. After this has been done, we now need to collet all the URLs into a list in the Cluster entity, as follows:
    +
    +~~~yaml
    +brooklyn.enrichers:
    +  - type: org.apache.brooklyn.enricher.stock.Aggregator
    +    brooklyn.config:
    +      enricher.sourceSensor: $brooklyn:sensor("url.tcp")
    +      enricher.targetSensor: $brooklyn:sensor("urls.tcp.list")
    +      enricher.aggregating.fromMembers: true
    +
    +~~~
    +In the proceeding example, we aggregate all of the TCP urls generated in the early example. These are then stored in a sensor called urls.tcp.list. This list is then joined together into one long string:
    --- End diff --
    
    s/proceeding/preceding/


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by Graeme-Miller <gi...@git.apache.org>.
Github user Graeme-Miller commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r46126980
  
    --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/collections/CollectionFunctionals.java ---
    @@ -107,12 +107,12 @@ public Integer apply(Iterable<?> input) {
         }
     
         public static final class FirstElementFunction<T> implements Function<Iterable<? extends T>, T> {
    -        private FirstElementFunction() {
    +        public FirstElementFunction() {
    --- End diff --
    
    yup, it is needed to use it from YAML.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r45970000
  
    --- Diff: docs/guide/yaml/advanced-example.md ---
    @@ -0,0 +1,177 @@
    +---
    +title: YAML BLueprint Advanced Example
    +layout: website-normal
    +---
    +
    +By this point you should be familiar with the fundamental concepts behind both Apache Brooklyn and YAML blueprints. This section of the documentation is intended to show a complete, advanced example of a YAML blueprint.
    +
    +The intention is that this example is used to learn the more in-depth concepts, but also to serve as a reference point when writing your own blueprints. This page will first exaplin what the example is and how to run it, then it will spotlight interesting features.
    +
    +
    +### The Example
    +
    +The example itself is a deployment of an ELK stack. ELK stands for Elasticsearch, Logstash and Kibana- and this blueprint deploys, installs, runs and manages all three. Briefly, the component parts are:
    +
    +* Elasticsearch: A clustered search engine
    +* Logstash: Collects, parses and stores logs. For our application it will store logs in Elasticsearch
    +* Kibana: A front end to Elasticsearch
    +
    +For more about the ELK stack, please see the documentation [here](https://www.elastic.co/webinars/introduction-elk-stack).
    +
    +In our example, we will be creating the ELK stack, and a Tomcat8 server which sends its logs using Logstash to Elasticsearch.
    +
    +#### The Blueprints
    +-----------
    +
    +There are four blueprints that make up this application. Each of them are used to add one or more catalog items to Brooklyn. You can find them below:
    +
    +* [Elasticsearch](example_yaml/brooklyn-elasticsearch-catalog.bom)
    +* [Logstash](example_yaml/brooklyn-logstash-catalog.bom)
    +* [Kibana](example_yaml/brooklyn-kibana-catalog.bom)
    +* [ELK](example_yaml/brooklyn-elk-catalog.bom)
    +
    +#### Running the example
    +First, add all four blueprints to the Brooklyn Catalog. This can be done by clicking the 'Catalog' tab, clinking the '+' symbol and pasting the YAML. Once this is done , click the 'Application' then the '+' button to bring up the add application wizard. A new Catalog item will be available called 'ELK Stack'. Using the add application wizard, you should be able to deploy an ELK stack to a location of your choosing.
    +
    +#### Exploring the example
    +After the example has been deployed, you can ensure it is working as expected by checking the following:
    +
    +* There is a Kibana sensor called "main.uri", the value of which points to the Kibana front end. You can explore this front end, and observe the logs stored in Elasticsearch. Many Brooklyn applications have a "main.uri" set to point you in the right direction.
    +* You can also use the Elasticsearch REST API to explore further. The ES entity has an "urls.http.list" sensor. Choosing an url from there you will be able to access the REST API. The following URL will give you the state of the cluster "{es-url}/\_cluster/health?pretty=true". As you can see the number_of_nodes is currently 2, indicating that the Elasticsearch nodes are communicating with each other.
    +
    +### Interesting Feature Spotlight
    +We will mainly focus on the Elasticsearch blueprint, and will be clear when another blueprint is being discussed. This blueprint is a cluster of Elasticsearch nodes. Clustering is a useful technique that is explained in more depth [here](../clusters.html).
    +
    +#### Provisioning Properties
    +Our Elasticsearch blueprint has a few requirements of the location in which it is run. Firstly, it must be run on an Ubuntu machine to simplify installation. Secondly, there are two ports that need to be opened to ensure that the entities can be accessed from the outside world. These are configured on the provisioning.properties as follows:
    +
    +~~~yaml
    +provisioning.properties:
    +  osFamily: ubuntu
    +  inboundPorts:
    +    - $brooklyn:config("elasticsearch.http.port")
    +    - $brooklyn:config("elasticsearch.tcp.port")
    +~~~
    +
    +#### VanillaSoftwareProcess
    +When composing a YAML blueprint, the VanillaSoftwareProcess is a very useful entity to be aware of. A VanillaSoftwareProcess will instruct Brooklyn to provision an instance, and run a series of shell commands to setup, run, monitor and teardown your program. The commands are specified as configuration on the VanillaSoftwareProcess and there are several available. We will spotlight a few now. To simplify this blueprint, we have specified ubuntu only installs so that our commands can be tailored to this system (E.G. use apt-get rather than YUM).
    +
    +##### Customize Command
    +The Customize Command is run after the application has been installed but before it is run. It is the perfect place to create and amend config files. Please refer to the following section of the Elasticsearch blueprint:
    +
    +~~~yaml
    +customize.command: |
    +  $brooklyn:formatString("
    +  sudo rm -fr sudo tee /etc/elasticsearch/elasticsearch.yml;
    +  echo discovery.zen.ping.multicast.enabled: false | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  echo discovery.zen.ping.unicast.enabled: true | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  echo 'discovery.zen.ping.unicast.hosts: %s' | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  echo http.port: %s | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  echo transport.tcp.port: %s | sudo tee -a /etc/elasticsearch/elasticsearch.yml;
    +  ",
    +  $brooklyn:component("parent", "").attributeWhenReady("urls.tcp.withBrackets"),
    +  $brooklyn:config("elasticsearch.http.port"),
    +  $brooklyn:config("elasticsearch.tcp.port")
    +  )
    +~~~
    +The purpose of this section is to create a YAML file with all of the required configuration. We use the YAML literal style "|" indicator to write a multi line command. We then use $brooklyn:formatString notation to build the string from configuration. We start our series of commands by using the "rm" command to remove the previous config file. We then use "echo" and "tee" to create the new config file and insert the config. Part of the configuration is a list of all hosts that is set on the parent entity- this is done by using a combination of the "component" and  "attributeWhenReady" DSL commands. More on how this is generated later.
    +
    +##### Check running
    +After an app is installed and run, this command will be run regularly and used to populate the "service.isUp" sensor. If this command is not specified, or returns an exit code of anything other than zero, then Brooklyn will assume that your entity is broken and will display the fire status symbol. Please refer to the following section of the Elasticsearch blueprint:
    +
    +~~~yaml
    +checkRunning.command: |
    +  $brooklyn:formatString("counter=`wget -T 15 -q -O- %s:%s | grep -c \"status. : 200\"`; if [ $counter -eq 0 ]; then exit 1; fi",
    +  $brooklyn:attributeWhenReady("host.address"),
    +  $brooklyn:config("elasticsearch.http.port"))
    +~~~
    +There are many different ways to implement this command. For this example, we are querying the REST API to get the status. This command creates a variable called counter, and populates it by performing a "WGET" call to the status URL or the Elasticsearch node, grepping for a 200 status OK code. We then check the counter is populated (I.E. that the end point does return status 200) and exit with an error code of one if not.
    +
    +#### Enrichers
    +
    +##### Elasticsearch URLS
    +To ensure that all Elasticsearch nodes can communicate with each other they need to be configured with the TCP URL of all other nodes. Similarly, the Logstash instances need to be configured with all the HTTP URLs of the Elasticsearch nodes. The mechanism for doing this is the same, and involves using Transformers, Aggregators and Joiners, as follows:
    +
    +~~~yaml
    +brooklyn.enrichers:
    +  - type: org.apache.brooklyn.enricher.stock.Transformer
    +    brooklyn.config:
    +      enricher.sourceSensor: $brooklyn:sensor("host.address")
    +      enricher.targetSensor: $brooklyn:sensor("url.tcp")
    +      enricher.targetValue: $brooklyn:formatString("%s:%s", $brooklyn:attributeWhenReady("host.address"), $brooklyn:config("elasticsearch.tcp.port"))  
    +~~~
    +
    +In this example, we take the host.address and append the TCP port, outputting the result as url.tcp. After this has been done, we now need to collet all the URLs into a list in the Cluster entity, as follows:
    --- End diff --
    
    `collet`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r45970316
  
    --- Diff: docs/guide/yaml/example_yaml/brooklyn-elasticsearch-catalog.bom ---
    @@ -0,0 +1,126 @@
    +brooklyn.catalog:
    +  id: elasticsearch
    +  version: 1.0
    +  iconUrl: https://avatars0.githubusercontent.com/u/6764390?v=3&s=400
    +  name: Elasticsearch
    +  license: Apache-2.0
    +  maintainer_name: Graeme Miller
    +  maintainer_email: graeme.miller@cloudsoftcorp.com
    --- End diff --
    
    Would prefer to exclude maintainer name/email for the same reason as `@author` tags are discouraged.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-brooklyn/pull/1070


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#issuecomment-160098715
  
    editorial comments from @sjcorbett and minor comment from me, otherwise good to merge
    
    nice to have these, at least in the short term
    
    longer term i'd like them all in a hosted catalog, maybe fewer here -- and those which are here we need to make part of a QA regime!!!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r45967503
  
    --- Diff: docs/guide/yaml/advanced-example.md ---
    @@ -0,0 +1,177 @@
    +---
    +title: YAML BLueprint Advanced Example
    +layout: website-normal
    +---
    +
    +By this point you should be familiar with the fundamental concepts behind both Apache Brooklyn and YAML blueprints. This section of the documentation is intended to show a complete, advanced example of a YAML blueprint.
    +
    +The intention is that this example is used to learn the more in-depth concepts, but also to serve as a reference point when writing your own blueprints. This page will first exaplin what the example is and how to run it, then it will spotlight interesting features.
    +
    +
    +### The Example
    +
    +The example itself is a deployment of an ELK stack. ELK stands for Elasticsearch, Logstash and Kibana- and this blueprint deploys, installs, runs and manages all three. Briefly, the component parts are:
    +
    +* Elasticsearch: A clustered search engine
    +* Logstash: Collects, parses and stores logs. For our application it will store logs in Elasticsearch
    +* Kibana: A front end to Elasticsearch
    +
    +For more about the ELK stack, please see the documentation [here](https://www.elastic.co/webinars/introduction-elk-stack).
    +
    +In our example, we will be creating the ELK stack, and a Tomcat8 server which sends its logs using Logstash to Elasticsearch.
    +
    +#### The Blueprints
    +-----------
    +
    +There are four blueprints that make up this application. Each of them are used to add one or more catalog items to Brooklyn. You can find them below:
    +
    +* [Elasticsearch](example_yaml/brooklyn-elasticsearch-catalog.bom)
    +* [Logstash](example_yaml/brooklyn-logstash-catalog.bom)
    +* [Kibana](example_yaml/brooklyn-kibana-catalog.bom)
    +* [ELK](example_yaml/brooklyn-elk-catalog.bom)
    +
    +#### Running the example
    +First, add all four blueprints to the Brooklyn Catalog. This can be done by clicking the 'Catalog' tab, clinking the '+' symbol and pasting the YAML. Once this is done , click the 'Application' then the '+' button to bring up the add application wizard. A new Catalog item will be available called 'ELK Stack'. Using the add application wizard, you should be able to deploy an ELK stack to a location of your choosing.
    --- End diff --
    
    `the 'Application'` what?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r46033023
  
    --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/collections/CollectionFunctionals.java ---
    @@ -107,12 +107,12 @@ public Integer apply(Iterable<?> input) {
         }
     
         public static final class FirstElementFunction<T> implements Function<Iterable<? extends T>, T> {
    -        private FirstElementFunction() {
    +        public FirstElementFunction() {
    --- End diff --
    
    I suspect it's necessary to use it from YAML:
    ```
         enricher.transformation:
         $brooklyn:object:
           type: "org.apache.brooklyn.util.collections.CollectionFunctionals$FirstElementFunction"
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r46031121
  
    --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/collections/CollectionFunctionals.java ---
    @@ -107,12 +107,12 @@ public Integer apply(Iterable<?> input) {
         }
     
         public static final class FirstElementFunction<T> implements Function<Iterable<? extends T>, T> {
    -        private FirstElementFunction() {
    +        public FirstElementFunction() {
             }
     
             @Override
             public T apply(Iterable<? extends T> input) {
    -            if (input==null) return null;
    +            if (input==null || Iterables.isEmpty(input)) return null;
    --- End diff --
    
    good addition!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#issuecomment-160608580
  
    Jenkins failure caused by 1075. Will merge this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r46031229
  
    --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/collections/CollectionFunctionals.java ---
    @@ -107,12 +107,12 @@ public Integer apply(Iterable<?> input) {
         }
     
         public static final class FirstElementFunction<T> implements Function<Iterable<? extends T>, T> {
    -        private FirstElementFunction() {
    +        public FirstElementFunction() {
    --- End diff --
    
    is this needed?  we have a static method `CollectionFunctionals.firstElement()` to return the instance, and the class is `final` so you can't subclass so i'm not sure what benefit there is from making this public.  (a javadoc on the constructor pointing at the method could be useful though!)
    
    no strong feelings though


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Added some advanced YAML examples

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1070#discussion_r45967456
  
    --- Diff: docs/guide/yaml/advanced-example.md ---
    @@ -0,0 +1,177 @@
    +---
    +title: YAML BLueprint Advanced Example
    +layout: website-normal
    +---
    +
    +By this point you should be familiar with the fundamental concepts behind both Apache Brooklyn and YAML blueprints. This section of the documentation is intended to show a complete, advanced example of a YAML blueprint.
    +
    +The intention is that this example is used to learn the more in-depth concepts, but also to serve as a reference point when writing your own blueprints. This page will first exaplin what the example is and how to run it, then it will spotlight interesting features.
    +
    +
    +### The Example
    +
    +The example itself is a deployment of an ELK stack. ELK stands for Elasticsearch, Logstash and Kibana- and this blueprint deploys, installs, runs and manages all three. Briefly, the component parts are:
    +
    +* Elasticsearch: A clustered search engine
    +* Logstash: Collects, parses and stores logs. For our application it will store logs in Elasticsearch
    +* Kibana: A front end to Elasticsearch
    +
    +For more about the ELK stack, please see the documentation [here](https://www.elastic.co/webinars/introduction-elk-stack).
    +
    +In our example, we will be creating the ELK stack, and a Tomcat8 server which sends its logs using Logstash to Elasticsearch.
    +
    +#### The Blueprints
    +-----------
    +
    +There are four blueprints that make up this application. Each of them are used to add one or more catalog items to Brooklyn. You can find them below:
    +
    +* [Elasticsearch](example_yaml/brooklyn-elasticsearch-catalog.bom)
    +* [Logstash](example_yaml/brooklyn-logstash-catalog.bom)
    +* [Kibana](example_yaml/brooklyn-kibana-catalog.bom)
    +* [ELK](example_yaml/brooklyn-elk-catalog.bom)
    +
    +#### Running the example
    +First, add all four blueprints to the Brooklyn Catalog. This can be done by clicking the 'Catalog' tab, clinking the '+' symbol and pasting the YAML. Once this is done , click the 'Application' then the '+' button to bring up the add application wizard. A new Catalog item will be available called 'ELK Stack'. Using the add application wizard, you should be able to deploy an ELK stack to a location of your choosing.
    --- End diff --
    
    `done , click`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---