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 #180: Update bundle upload
Date Wed, 10 May 2017 10:00:37 GMT
Github user drigodwin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-docs/pull/180#discussion_r115700585
  
    --- Diff: guide/blueprints/catalog/index.md ---
    @@ -371,6 +373,126 @@ 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
    +
    +It is possible to add an OSGi bundle to AMP. This is useful when you have a blueprint
that needs to reference external scripts/resources or when you have multiple blueprints that
you want to keep in sync. Brooklyn will persist any uploaded bundles so that they are available
after a restart, or a HA failover.
    +
    +In this example, we will create a simple `my-server` catalog item, bundled with a simple
script. The script will be run when launching the server.
    +
    +First, create a folder called bundleFolder, then add a file called myfile.sh to it. 
    +The contents of myfile.sh should be as follows:
    +
    +~~~ bash
    +echo Hello, World!
    +~~~
    +
    +Now create a file in bundleFolder called `catalog.bom` with the following contents:
    +
    +~~~ yaml
    +brooklyn.catalog:
    +  bundle: MyServerBundle
    +  version: 1.0.0
    +  item:  
    +    id: my-server
    +    type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
    +    brooklyn.config:
    +      files.runtime:
    +        classpath://myfile.sh: files/myfile.sh
    +      launch.command: |
    +        chmod +x ./files/myfile.sh
    +        ./files/myfile.sh
    +        
    +      checkRunning.command:
    +        echo "Running"  
    +        
    +~~~
    +
    +The `bundle: MyServerBundle` line specifies the OSGI bundle name for this bundle. 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 use the BR command as follows:
    +
    +~~~ bash
    +br add-catalog bundleFolder
    +~~~
    +
    +This will have added our bundle to the catalog. We can now deploy an instance of our
server as follows:
    +
    +~~~ yaml
    +location: localhost
    --- End diff --
    
    If you're going to use localhost for an example, probably link to the localhost configuration
section. It might be better to assume people are using vagrant and use the byon location from
the getting started.


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