You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by Graham Ashby <Gr...@ca.ibm.com> on 2017/03/10 14:15:29 UTC

Catalog "bundle"

(Not an OSGi bundle...)
I've developed a set of YAML catalog entries for defining my application. 
Now I want to be able to distribute them so other people can load them 
into their Brooklyn server.
I see that there are ways of defining an initial catalog, but as I see it, 
this is a single file.  In my case, I have a number of separate catalog 
entries, so I don't want to embed them into a single yaml file.  Including 
them doesn't really work either, as then I'd need to know in advance 
exactly what was in my set.
What I'd ideally like is to be able to, say, point the server at a zip 
file of catalog entries, and have them all loaded.
I tried reading through the code, so I have suspicions it could be done, 
but I'm not sure how.

So, is there a way to do this?  The zip file (or whatever) would probably 
be on the local file system.

Thanks
Graham


Re: Catalog "bundle"

Posted by Geoff Macartney <ge...@cloudsoftcorp.com>.
p.s. whoops, sorry, I mean "Graham"!   It's a colleague of mine who spells
his name the other way!

regards
Geoff

On Tue, 14 Mar 2017 at 10:42 Geoff Macartney <
geoff.macartney@cloudsoftcorp.com> wrote:

> hi Graeme,
>
> it's still possible to put all your catalog files into an OSGI bundle, if
> you would prefer to do that. That's basically what the clocker example is
> doing that Thomas linked to.
>
> Just add your various boms as resources in the bundle when you build it.
> You'll need to add the bundle to Brooklyn of course -  either, for classic
> launcher, put it in lib/dropins, or, for Karaf, either use "bundle:install"
> from the command line, or add a catalog entry with your bundle as a
> "brooklyn.library".
>
> For example, I knocked together a test bundle "brooklyn-dist-temp" with
> three boms in it.  I can then add the item below to my catalog, (I'm
> running in Karaf launcher) and Brooklyn reads the bundle at the given URL
> (just a file:// in this case but could be http://), and adds the various
> definitions in each of the included boms into my catalog.
>
>   brooklyn.catalog:
>     version: "0.11.0-SNAPSHOT"
>
>     brooklyn.libraries:
>     -
> file:///Users/geoff/.m2/repository/org/apache/brooklyn/brooklyn-dist-temp/0.11.0-SNAPSHOT/brooklyn-dist-temp-0.11.0-SNAPSHOT.jar
>
>     items:
>     - classpath://org.apache.brooklyn.dist-temp:catalog1.bom
>     - classpath://org.apache.brooklyn.dist-temp:catalog2.bom
>     - classpath://org.apache.brooklyn.dist-temp:catalog3.bom
>
> Is that the sort of thing you mean?  Note that the classpath url format is
> "classpath://"  + bundle-symbolic-name + ":" + resource-name.
>
> Geoff
>
> On Fri, 10 Mar 2017 at 16:41 Graham Ashby <Gr...@ca.ibm.com> wrote:
>
> Hmm.
> It's interesting that if I wrote this as a series of Java classes, I could
> put this in the dropins folder, and load a set of catalog entries in one
> go.
> I imagine that isn't possible for yaml -- turn them into an OSGi bundle?
> I notice also that resources (files, etc) can be specified as on the
> classpath.  Any hope that we could do that for catalog items?
>
> Thanks
> Graham
>
>
>
> From:   Geoff Macartney <ge...@cloudsoftcorp.com>
> To:     Brooklyn dev <de...@brooklyn.apache.org>
> Date:   03/10/2017 11:07 AM
> Subject:        Re: Catalog "bundle"
>
>
>
> hi Graham
>
> One point worth mentioning in relation to
> https://github.com/apache/brooklyn-server/pull/485 is that it will provide
> the ability to upload via the REST API, but there will still be further
> work needed to make this easy to use.  I plan to do some changes to the
> command line client "br" to allow it to make use of the new API when it
> arrives, so that you'll be able to do something like "br upload ..." and
> it
> will upload a zip of your project.   I'm not sure that anyone's discussed
> adding this to the UI yet but that might be something for the future as
> well.
>
> Cheers
> Geoff
>
>
>
> On Fri, 10 Mar 2017 at 14:56 Thomas Bouron
> <th...@cloudsoftcorp.com>
> wrote:
>
> > Hi Graham.
> >
> > Uploading a ZIP file to Brooklyn is indeed a good idea. The good news
> is,
> > there is a PR to support this in `brooklyn-server`[1]. The slightly less
> > good news is that it's still in review and therefore not available yet
> in
> > the stable version.
> >
> > However, there are few of workarounds this.
> >
> > You could host your different bom files anywhere you want, then
> reference
> > those into your main BOM file like so:
> > ```
> > brooklyn.catalog:
> >   id: your-id
> >   items:
> >   - item: http://.....
> >   - item: http://.....
> > ```
> >
> > Or you could create a JAR with all your resources inside then reference
> > this in your main BOM file, similar to what Clocker does[2].
> >
> > Finally, you would just distribute your main BOM file to other users.
> >
> > [1] https://github.com/apache/brooklyn-server/pull/485
> > [2] https://github.com/brooklyncentral/clocker/blob/master/clocker.bom
> >
> > On Fri, 10 Mar 2017 at 14:15 Graham Ashby <Gr...@ca.ibm.com>
> wrote:
> >
> > > (Not an OSGi bundle...)
> > > I've developed a set of YAML catalog entries for defining my
> application.
> > > Now I want to be able to distribute them so other people can load them
> > > into their Brooklyn server.
> > > I see that there are ways of defining an initial catalog, but as I see
> > it,
> > > this is a single file.  In my case, I have a number of separate
> catalog
> > > entries, so I don't want to embed them into a single yaml file.
> > Including
> > > them doesn't really work either, as then I'd need to know in advance
> > > exactly what was in my set.
> > > What I'd ideally like is to be able to, say, point the server at a zip
> > > file of catalog entries, and have them all loaded.
> > > I tried reading through the code, so I have suspicions it could be
> done,
> > > but I'm not sure how.
> > >
> > > So, is there a way to do this?  The zip file (or whatever) would
> probably
> > > be on the local file system.
> > >
> > > Thanks
> > > Graham
> > >
> > > --
> >
> > Thomas Bouron • Software Engineer @ Cloudsoft Corporation •
> > http://www.cloudsoftcorp.com/
> > Github: https://github.com/tbouron
> > Twitter: https://twitter.com/eltibouron
> >
>
>
>
>
>

Re: Catalog "bundle"

Posted by Geoff Macartney <ge...@cloudsoftcorp.com>.
hi Graeme,

it's still possible to put all your catalog files into an OSGI bundle, if
you would prefer to do that. That's basically what the clocker example is
doing that Thomas linked to.

Just add your various boms as resources in the bundle when you build it.
You'll need to add the bundle to Brooklyn of course -  either, for classic
launcher, put it in lib/dropins, or, for Karaf, either use "bundle:install"
from the command line, or add a catalog entry with your bundle as a
"brooklyn.library".

For example, I knocked together a test bundle "brooklyn-dist-temp" with
three boms in it.  I can then add the item below to my catalog, (I'm
running in Karaf launcher) and Brooklyn reads the bundle at the given URL
(just a file:// in this case but could be http://), and adds the various
definitions in each of the included boms into my catalog.

  brooklyn.catalog:
    version: "0.11.0-SNAPSHOT"

    brooklyn.libraries:
    -
file:///Users/geoff/.m2/repository/org/apache/brooklyn/brooklyn-dist-temp/0.11.0-SNAPSHOT/brooklyn-dist-temp-0.11.0-SNAPSHOT.jar

    items:
    - classpath://org.apache.brooklyn.dist-temp:catalog1.bom
    - classpath://org.apache.brooklyn.dist-temp:catalog2.bom
    - classpath://org.apache.brooklyn.dist-temp:catalog3.bom

Is that the sort of thing you mean?  Note that the classpath url format is
"classpath://"  + bundle-symbolic-name + ":" + resource-name.

Geoff





On Fri, 10 Mar 2017 at 16:41 Graham Ashby <Gr...@ca.ibm.com> wrote:

Hmm.
It's interesting that if I wrote this as a series of Java classes, I could
put this in the dropins folder, and load a set of catalog entries in one
go.
I imagine that isn't possible for yaml -- turn them into an OSGi bundle?
I notice also that resources (files, etc) can be specified as on the
classpath.  Any hope that we could do that for catalog items?

Thanks
Graham



From:   Geoff Macartney <ge...@cloudsoftcorp.com>
To:     Brooklyn dev <de...@brooklyn.apache.org>
Date:   03/10/2017 11:07 AM
Subject:        Re: Catalog "bundle"



hi Graham

One point worth mentioning in relation to
https://github.com/apache/brooklyn-server/pull/485 is that it will provide
the ability to upload via the REST API, but there will still be further
work needed to make this easy to use.  I plan to do some changes to the
command line client "br" to allow it to make use of the new API when it
arrives, so that you'll be able to do something like "br upload ..." and
it
will upload a zip of your project.   I'm not sure that anyone's discussed
adding this to the UI yet but that might be something for the future as
well.

Cheers
Geoff



On Fri, 10 Mar 2017 at 14:56 Thomas Bouron
<th...@cloudsoftcorp.com>
wrote:

> Hi Graham.
>
> Uploading a ZIP file to Brooklyn is indeed a good idea. The good news
is,
> there is a PR to support this in `brooklyn-server`[1]. The slightly less
> good news is that it's still in review and therefore not available yet
in
> the stable version.
>
> However, there are few of workarounds this.
>
> You could host your different bom files anywhere you want, then
reference
> those into your main BOM file like so:
> ```
> brooklyn.catalog:
>   id: your-id
>   items:
>   - item: http://.....
>   - item: http://.....
> ```
>
> Or you could create a JAR with all your resources inside then reference
> this in your main BOM file, similar to what Clocker does[2].
>
> Finally, you would just distribute your main BOM file to other users.
>
> [1] https://github.com/apache/brooklyn-server/pull/485
> [2] https://github.com/brooklyncentral/clocker/blob/master/clocker.bom
>
> On Fri, 10 Mar 2017 at 14:15 Graham Ashby <Gr...@ca.ibm.com>
wrote:
>
> > (Not an OSGi bundle...)
> > I've developed a set of YAML catalog entries for defining my
application.
> > Now I want to be able to distribute them so other people can load them
> > into their Brooklyn server.
> > I see that there are ways of defining an initial catalog, but as I see
> it,
> > this is a single file.  In my case, I have a number of separate
catalog
> > entries, so I don't want to embed them into a single yaml file.
> Including
> > them doesn't really work either, as then I'd need to know in advance
> > exactly what was in my set.
> > What I'd ideally like is to be able to, say, point the server at a zip
> > file of catalog entries, and have them all loaded.
> > I tried reading through the code, so I have suspicions it could be
done,
> > but I'm not sure how.
> >
> > So, is there a way to do this?  The zip file (or whatever) would
probably
> > be on the local file system.
> >
> > Thanks
> > Graham
> >
> > --
>
> Thomas Bouron • Software Engineer @ Cloudsoft Corporation •
> http://www.cloudsoftcorp.com/
> Github: https://github.com/tbouron
> Twitter: https://twitter.com/eltibouron
>

Re: Catalog "bundle"

Posted by Graham Ashby <Gr...@ca.ibm.com>.
Hmm.
It's interesting that if I wrote this as a series of Java classes, I could 
put this in the dropins folder, and load a set of catalog entries in one 
go.
I imagine that isn't possible for yaml -- turn them into an OSGi bundle?
I notice also that resources (files, etc) can be specified as on the 
classpath.  Any hope that we could do that for catalog items?

Thanks
Graham



From:   Geoff Macartney <ge...@cloudsoftcorp.com>
To:     Brooklyn dev <de...@brooklyn.apache.org>
Date:   03/10/2017 11:07 AM
Subject:        Re: Catalog "bundle"



hi Graham

One point worth mentioning in relation to
https://github.com/apache/brooklyn-server/pull/485 is that it will provide
the ability to upload via the REST API, but there will still be further
work needed to make this easy to use.  I plan to do some changes to the
command line client "br" to allow it to make use of the new API when it
arrives, so that you'll be able to do something like "br upload ..." and 
it
will upload a zip of your project.   I'm not sure that anyone's discussed
adding this to the UI yet but that might be something for the future as
well.

Cheers
Geoff



On Fri, 10 Mar 2017 at 14:56 Thomas Bouron 
<th...@cloudsoftcorp.com>
wrote:

> Hi Graham.
>
> Uploading a ZIP file to Brooklyn is indeed a good idea. The good news 
is,
> there is a PR to support this in `brooklyn-server`[1]. The slightly less
> good news is that it's still in review and therefore not available yet 
in
> the stable version.
>
> However, there are few of workarounds this.
>
> You could host your different bom files anywhere you want, then 
reference
> those into your main BOM file like so:
> ```
> brooklyn.catalog:
>   id: your-id
>   items:
>   - item: http://.....
>   - item: http://.....
> ```
>
> Or you could create a JAR with all your resources inside then reference
> this in your main BOM file, similar to what Clocker does[2].
>
> Finally, you would just distribute your main BOM file to other users.
>
> [1] https://github.com/apache/brooklyn-server/pull/485
> [2] https://github.com/brooklyncentral/clocker/blob/master/clocker.bom
>
> On Fri, 10 Mar 2017 at 14:15 Graham Ashby <Gr...@ca.ibm.com> 
wrote:
>
> > (Not an OSGi bundle...)
> > I've developed a set of YAML catalog entries for defining my 
application.
> > Now I want to be able to distribute them so other people can load them
> > into their Brooklyn server.
> > I see that there are ways of defining an initial catalog, but as I see
> it,
> > this is a single file.  In my case, I have a number of separate 
catalog
> > entries, so I don't want to embed them into a single yaml file.
> Including
> > them doesn't really work either, as then I'd need to know in advance
> > exactly what was in my set.
> > What I'd ideally like is to be able to, say, point the server at a zip
> > file of catalog entries, and have them all loaded.
> > I tried reading through the code, so I have suspicions it could be 
done,
> > but I'm not sure how.
> >
> > So, is there a way to do this?  The zip file (or whatever) would 
probably
> > be on the local file system.
> >
> > Thanks
> > Graham
> >
> > --
>
> Thomas Bouron • Software Engineer @ Cloudsoft Corporation •
> http://www.cloudsoftcorp.com/
> Github: https://github.com/tbouron
> Twitter: https://twitter.com/eltibouron
>





Re: Catalog "bundle"

Posted by Geoff Macartney <ge...@cloudsoftcorp.com>.
hi Graham

One point worth mentioning in relation to
https://github.com/apache/brooklyn-server/pull/485 is that it will provide
the ability to upload via the REST API, but there will still be further
work needed to make this easy to use.  I plan to do some changes to the
command line client "br" to allow it to make use of the new API when it
arrives, so that you'll be able to do something like "br upload ..." and it
will upload a zip of your project.   I'm not sure that anyone's discussed
adding this to the UI yet but that might be something for the future as
well.

Cheers
Geoff



On Fri, 10 Mar 2017 at 14:56 Thomas Bouron <th...@cloudsoftcorp.com>
wrote:

> Hi Graham.
>
> Uploading a ZIP file to Brooklyn is indeed a good idea. The good news is,
> there is a PR to support this in `brooklyn-server`[1]. The slightly less
> good news is that it's still in review and therefore not available yet in
> the stable version.
>
> However, there are few of workarounds this.
>
> You could host your different bom files anywhere you want, then reference
> those into your main BOM file like so:
> ```
> brooklyn.catalog:
>   id: your-id
>   items:
>   - item: http://.....
>   - item: http://.....
> ```
>
> Or you could create a JAR with all your resources inside then reference
> this in your main BOM file, similar to what Clocker does[2].
>
> Finally, you would just distribute your main BOM file to other users.
>
> [1] https://github.com/apache/brooklyn-server/pull/485
> [2] https://github.com/brooklyncentral/clocker/blob/master/clocker.bom
>
> On Fri, 10 Mar 2017 at 14:15 Graham Ashby <Gr...@ca.ibm.com> wrote:
>
> > (Not an OSGi bundle...)
> > I've developed a set of YAML catalog entries for defining my application.
> > Now I want to be able to distribute them so other people can load them
> > into their Brooklyn server.
> > I see that there are ways of defining an initial catalog, but as I see
> it,
> > this is a single file.  In my case, I have a number of separate catalog
> > entries, so I don't want to embed them into a single yaml file.
> Including
> > them doesn't really work either, as then I'd need to know in advance
> > exactly what was in my set.
> > What I'd ideally like is to be able to, say, point the server at a zip
> > file of catalog entries, and have them all loaded.
> > I tried reading through the code, so I have suspicions it could be done,
> > but I'm not sure how.
> >
> > So, is there a way to do this?  The zip file (or whatever) would probably
> > be on the local file system.
> >
> > Thanks
> > Graham
> >
> > --
>
> Thomas Bouron • Software Engineer @ Cloudsoft Corporation •
> http://www.cloudsoftcorp.com/
> Github: https://github.com/tbouron
> Twitter: https://twitter.com/eltibouron
>

Re: Catalog "bundle"

Posted by Thomas Bouron <th...@cloudsoftcorp.com>.
Hi Graham.

Uploading a ZIP file to Brooklyn is indeed a good idea. The good news is,
there is a PR to support this in `brooklyn-server`[1]. The slightly less
good news is that it's still in review and therefore not available yet in
the stable version.

However, there are few of workarounds this.

You could host your different bom files anywhere you want, then reference
those into your main BOM file like so:
```
brooklyn.catalog:
  id: your-id
  items:
  - item: http://.....
  - item: http://.....
```

Or you could create a JAR with all your resources inside then reference
this in your main BOM file, similar to what Clocker does[2].

Finally, you would just distribute your main BOM file to other users.

[1] https://github.com/apache/brooklyn-server/pull/485
[2] https://github.com/brooklyncentral/clocker/blob/master/clocker.bom

On Fri, 10 Mar 2017 at 14:15 Graham Ashby <Gr...@ca.ibm.com> wrote:

> (Not an OSGi bundle...)
> I've developed a set of YAML catalog entries for defining my application.
> Now I want to be able to distribute them so other people can load them
> into their Brooklyn server.
> I see that there are ways of defining an initial catalog, but as I see it,
> this is a single file.  In my case, I have a number of separate catalog
> entries, so I don't want to embed them into a single yaml file.  Including
> them doesn't really work either, as then I'd need to know in advance
> exactly what was in my set.
> What I'd ideally like is to be able to, say, point the server at a zip
> file of catalog entries, and have them all loaded.
> I tried reading through the code, so I have suspicions it could be done,
> but I'm not sure how.
>
> So, is there a way to do this?  The zip file (or whatever) would probably
> be on the local file system.
>
> Thanks
> Graham
>
> --

Thomas Bouron • Software Engineer @ Cloudsoft Corporation •
http://www.cloudsoftcorp.com/
Github: https://github.com/tbouron
Twitter: https://twitter.com/eltibouron