brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigodwin <...@git.apache.org>
Subject [GitHub] brooklyn-docs pull request #164: Adds documentation for bundling catalog res...
Date Fri, 07 Apr 2017 09:59:51 GMT
Github user drigodwin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-docs/pull/164#discussion_r110355931
  
    --- Diff: guide/ops/catalog/index.md ---
    @@ -371,6 +372,121 @@ increment an internal version number for the catalog item.
     When referencing a blueprint, if a version number is not specified 
     the latest non-snapshot version will be loaded when an entity is instantiated.
     
    +### Bundling Catalog Resources
    +
    +When deploying a blueprint, it is possible to deploy as an OSGI bundle with additional
resources scoped to
    +this bundle. This is particularly useful when, for example, deploying a Tomcat server
with a `.war` file
    +which is deployed using a classpath path such as `classpath://mywar.war`.
    +
    +In this example, we will create a simple `server` catalog item, bundled with a simple
text file
    +
    +First, create the text file with some sample contents:
    +
    +~~~ bash
    +echo Hello, World! > myfile.txt
    +~~~
    +
    +Now create a file called `catalog.bom` with the following contents:
    +
    +~~~ yaml
    +brooklyn.catalog:
    +  bundle: script-server
    +  version: 1.0.0
    +  items:
    +  - id: script-server
    +    itemType: entity
    +    item:
    +      type: server
    +      brooklyn.config:
    +        files.runtime:
    +          classpath://myfile.txt: files/myfile.txt
    +~~~
    +
    +The `bundle: script-server` line specifies the OSGI buldle name for this blueprint. Any
resources included
    +in this bundle will be accessible on the classpath, but will be scoped to this bundle.
This prevents an
    +issue where multiple bundles include the same resource.
    +
    +To create the bundle, simply zip the `.bom` and `.txt` files as follows:
    +
    +~~~ bash
    +zip script-server.zip catalog.bom myfile.txt
    +~~~
    +
    +Currently the only supported method for uploading the bundle to the server is via the
API, e.g. using
    +`curl`:
    +
    +~~~ bash
    +curl -X POST -u admin:password -H "Content-Type: application/zip" --data-binary @/tmp/zip/script-server.zip
"http://127.0.0.1:8081/v1/catalog"
    +~~~
    +
    +We can now deploy an instance of our script server as follows:
    +
    +~~~ yaml
    +location: localhost
    +services:
    +- type: script-server
    +~~~
    +
    +And we can now inspect the contents of the file copied to the server
    +
    +~~~ bash
    +$ cat /tmp/brooklyn-martin/apps/nl9djqbq2i/entities/EmptySoftwareProcess_g52gahfxnt/files/myfile.txt
    --- End diff --
    
    The preference is now to not include a `$` at the start of the line but, if required,
to split the command and response into two blocks


---
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.
---

Mime
View raw message