brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nakomis <>
Subject [GitHub] brooklyn-docs pull request #180: Update bundle upload
Date Wed, 10 May 2017 09:52:25 GMT
Github user nakomis commented on a diff in the pull request:
    --- Diff: guide/blueprints/catalog/ ---
    @@ -375,153 +375,120 @@ 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 it 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`.
    +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 `server` catalog item, bundled with a simple
text file.
    +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 the text file with some sample contents:
    +First, create a folder called bundleFolder, then add a file called to it. 
    +The contents of should be as follows:
     ~~~ bash
    -echo Hello, World! > myfile.txt
    +echo Hello, World!
    -Now create a file called `` with the following contents:
    +Now create a file in bundleFolder called `` with the following contents:
     ~~~ yaml
    -  bundle: script-server
    +  bundle: MyServerBundle
       version: 1.0.0
    -  items:
    -  - id: script-server
    -    itemType: entity
    -    item:
    -      type: server
    -      brooklyn.config:
    -        files.runtime:
    -          classpath://myfile.txt: files/myfile.txt
    +  item:  
    +    id: my-server
    +    type:
    +    brooklyn.config:
    +      files.runtime:
    +        classpath:// files/
    +      launch.command: |
    +        chmod +x ./files/
    +        ./files/
    +      checkRunning.command:
    +        echo "Running"  
    -The `bundle: script-server` line specifies the OSGI bundle name for this blueprint. Any
resources included
    +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 zip the `.bom` and `.txt` files as follows:
    +To create the bundle, simply use the BR command as follows:
     ~~~ bash
    -zip myfile.txt
    +br add-catalog bundleFolder
    -Currently the only supported method for uploading the bundle to the server is via the
API, e.g. using
    -~~~ bash
    -curl -X POST -u admin:password -H "Content-Type: application/zip" --data-binary @/tmp/zip/
    -We can now deploy an instance of our script server as follows:
    +This will have added our bundle to the catalog. We can now deploy an instance of our
server as follows:
     ~~~ yaml
     location: localhost
    -- type: script-server
    +- type: my-server
    -And we can now inspect the contents of the file copied to the server
    +We can now see the result of running that script. In the UI find the activities for this
application. The start activity has a sub task called launch (you will have to click through
multiple activities called start/launch. Looking at the stdout of the launch task you should
    -~~~ bash
    -cat /tmp/brooklyn-martin/apps/nl9djqbq2i/entities/EmptySoftwareProcess_g52gahfxnt/files/myfile.txt
    -~~~ bash
    +~~~ bash  
     Hello, World!
    -Now modify `myfile.txt` to contain a different message, change the version number in
`` to
    -`1.1.0`, re-build the zip file and re-post it to the server
    -If you now deploy a new instance of the script-server using the same YAML as used above,
you should be
    -able to confirm that the new script has been copied to the server:
    +Alternatively you can view the script directly if you ran this against localhost:
     ~~~ bash
    -cat /tmp/brooklyn-martin/apps/bwu57darkd/entities/EmptySoftwareProcess_umcgshzduk/files/myfile.txt

    +cat /tmp/brooklyn-username/apps/nl9djqbq2i/entities/EmptySoftwareProcess_g52gahfxnt/files/
    --- End diff --
    The script uses `VanillaSoftwareProcess`

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 or file a JIRA ticket
with INFRA.

View raw message