Few questions about Karaf and Cave

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Few questions about Karaf and Cave

giamma
Hello,

I am testing on Karaf an OSGi application that runs successfully in Eclipse
Virgo, WebSphere Liberty and plain Equinox (bndrun) using Pax Web.

The application is running as expected, and in order to provision it I
created a XML feature repository file containing several features and
configurations.

When creating the feature file if I don't or can't use maven URLs, can I use
variable substitutions in file:// URLs in orther to pickup bundles that I
copied into a folder, e.g.:
   
        file:///${karaf.base}/mybundles/my.bundle.jar

Can I do the same to copy to e.g. ${karaf.etc} additional configuration
files (<configfile> feature element)?

As an alternative approach, I would like to try OBR, which would make the
deployment more similar to that of Eclipse Virgo and WebSphere Liberty,
letting me re-use more of the existing build scripts.

By reading the documentation I understood that:
1 - I should install Karaf Cave which provides an OBR repository
2 - I should install OBR which will let Karaf resolve bundle requirements
against Cave
3 - I should deploy my top-level bundles either manually or by placing them
in the OBR repository
    and by listing them in a feature using an "obr:" URL.
4 - required bundle dependencies will be found by OBR in the Cave repository
and will be deployed for me


The Karaf documentation explains how to use Cave and how to create and
populate a repository, but:
* - the latest version of Cave, 4.2.0 has completely different shell
commands, in particular "upload" is gone
* - Cave 4.2.0 documentation describes a gateway command (don't know if that
helps) but that command
     does not show up in the shell even after installing the corresponding
feature as documented in the guide

With respect to Cave my questions are:
* - how can I create an OBR repository, populate it, and use it for
resolution when using Karaf 4.2.7 and
     Cave 4.2.0? If this is only possible with Cave 4.1.x, will the same
capability be available in a future
     Cave 4.2.x or is this deprecated?
* - is there a way for Cave to monitor the repo folder and auto-update the
repository.xml (like Virgo and
     WebSphere do, which do not even use repository.xml) or do I have to
manually update the
     repository every time a bundle is changed?

Thanks in advance.
Giamma.



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Few questions about Karaf and Cave

jbonofre
Hi,

I have some comments: why not using directly Karaf instead of inside Virgo ?

Why can't you use mvn ? You can always provision the Karaf system folder
which is actually an embedded Maven repository.

Yes, you can use "regular" URLs (like file or http), at runtime (using
feature:repo-add for instance) or before (using
etc/org.apache.karaf.features.cfg).

Variable substitution is not supported yet (it's a good idea by the way,
and worth to create a Jira), but you can prepare it at buildtime.

Yes, <configfile/> can also use any kind of URL (http, file, mvn, ...).

I don't think OBR is a good idea, however Karaf Cave is ;)

You can deploy all in Karaf Cave repository, and then use this
repository (via mvn or http URL).

Cave basically provides two things:
- Cave repository is interesting for you as it can store any kind of
artifacts that you can use in your Karaf instances
- Cave Features Gateway is just a "wrapper" of multiple features XML in
one big XML. You just do the feature:repo-add of the Gateway XML instead
of each individual XML locations. The gateway XML is managed by service.

Don't hesitate to ping me directly if you need more details or advices.

Regards
JB

On 05/11/2019 13:02, giamma wrote:

> Hello,
>
> I am testing on Karaf an OSGi application that runs successfully in Eclipse
> Virgo, WebSphere Liberty and plain Equinox (bndrun) using Pax Web.
>
> The application is running as expected, and in order to provision it I
> created a XML feature repository file containing several features and
> configurations.
>
> When creating the feature file if I don't or can't use maven URLs, can I use
> variable substitutions in file:// URLs in orther to pickup bundles that I
> copied into a folder, e.g.:
>    
>         file:///${karaf.base}/mybundles/my.bundle.jar
>
> Can I do the same to copy to e.g. ${karaf.etc} additional configuration
> files (<configfile> feature element)?
>
> As an alternative approach, I would like to try OBR, which would make the
> deployment more similar to that of Eclipse Virgo and WebSphere Liberty,
> letting me re-use more of the existing build scripts.
>
> By reading the documentation I understood that:
> 1 - I should install Karaf Cave which provides an OBR repository
> 2 - I should install OBR which will let Karaf resolve bundle requirements
> against Cave
> 3 - I should deploy my top-level bundles either manually or by placing them
> in the OBR repository
>     and by listing them in a feature using an "obr:" URL.
> 4 - required bundle dependencies will be found by OBR in the Cave repository
> and will be deployed for me
>
>
> The Karaf documentation explains how to use Cave and how to create and
> populate a repository, but:
> * - the latest version of Cave, 4.2.0 has completely different shell
> commands, in particular "upload" is gone
> * - Cave 4.2.0 documentation describes a gateway command (don't know if that
> helps) but that command
>      does not show up in the shell even after installing the corresponding
> feature as documented in the guide
>
> With respect to Cave my questions are:
> * - how can I create an OBR repository, populate it, and use it for
> resolution when using Karaf 4.2.7 and
>      Cave 4.2.0? If this is only possible with Cave 4.1.x, will the same
> capability be available in a future
>      Cave 4.2.x or is this deprecated?
> * - is there a way for Cave to monitor the repo folder and auto-update the
> repository.xml (like Virgo and
>      WebSphere do, which do not even use repository.xml) or do I have to
> manually update the
>      repository every time a bundle is changed?
>
> Thanks in advance.
> Giamma.
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Few questions about Karaf and Cave

giamma
Hello,

On Tue, Nov 5, 2019 at 2:46 PM Jean-Baptiste Onofré <[hidden email]> wrote:
Hi,

I have some comments: why not using directly Karaf instead of inside Virgo ?

I am using Karaf directly, I just mentioned Virgo and Liberty to explain that I am more familiar with OBR bundle repositories.

Why can't you use mvn ? You can always provision the Karaf system folder
which is actually an embedded Maven repository.

I am new to Karaf, I did not know. I suppose I could also add another folder if I wanted to keep my artifacts separate to be able to purge and recreate the repo more easily.
However, how do you create a m2 structure from a maven project? does the maven deploy plugin allows you to automate this for a project including its dependencies?
I hope I do not have to install one bundle at a time via mvn install.
 
Variable substitution is not supported yet (it's a good idea by the way,
and worth to create a Jira), but you can prepare it at buildtime.

Do you want me to open an enhancement request?

Cave basically provides two things:
- Cave repository is interesting for you as it can store any kind of
artifacts that you can use in your Karaf instances
- Cave Features Gateway is just a "wrapper" of multiple features XML in
one big XML. You just do the feature:repo-add of the Gateway XML instead
of each individual XML locations. The gateway XML is managed by service.

Don't hesitate to ping me directly if you need more details or advices.

I would like to understand better how I can create a repo and populate it with all the bundles in a folder using Cave 4.2.0. I could not figure out how to do that from the shell, it looks like this was possible in 4.1 but the 4.2 shell is missing some commands that existed before.
Maybe it is possible to populate a cave repo starting from a feature?

Reply | Threaded
Open this post in threaded view
|

Re: Few questions about Karaf and Cave

jbonofre
Hi,

Yes, you can add additional local repository just by editing
etc/org.ops4j.pax.url.mvn.cfg.

To populate the Maven repository, you can use the regular mvn deploy,
mvn deploy-file, etc commands.
You can also use Cave Repository/Deployer able to upload artifact.

+1 to create a Jira about variable. It's actually already partly
possible ({karaf.etc}, {karaf.base}, should work for instance), but I
would like to improve it a bit.

For Cave, you can:

1. Create a repository using:

karaf@root()> cave:repository-create my-repo

2. Upload artifact using in this repo using:

karaf@root()> cave:repository-artifact-add myrepo
mvn:commons-lang/commons-lang/2.6

or regular mvn command.

3. You can directly use the artifacts in Karaf. Just add the Cave
repository URL in etc/org.ops4j.pax.url.mvn.cfg, and then you can use
mvn in Karaf. You can also use http to access the Cave repository.

4. If you really want (but I don't see the value), you can still create
the OBR descriptor using:

karaf@root()> cave:repository-update-bundle-descriptor myrepo

NB: a repository can also be a mirror or proxy to another one, and you
can also define a trigger action on a repository.

I suggest to take a look on:

https://github.com/apache/karaf-cave/blob/master/manual/src/main/asciidoc/user-guide/repository.adoc

I'm publishing the updated documentation on Karaf website now.

Regards
JB

On 05/11/2019 17:22, Giamma wrote:

> Hello,
>
> On Tue, Nov 5, 2019 at 2:46 PM Jean-Baptiste Onofré <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     I have some comments: why not using directly Karaf instead of inside
>     Virgo ?
>
>
> I am using Karaf directly, I just mentioned Virgo and Liberty to explain
> that I am more familiar with OBR bundle repositories.
>
>     Why can't you use mvn ? You can always provision the Karaf system folder
>     which is actually an embedded Maven repository.
>
>
> I am new to Karaf, I did not know. I suppose I could also add another
> folder if I wanted to keep my artifacts separate to be able to purge and
> recreate the repo more easily.
> However, how do you create a m2 structure from a maven project? does the
> maven deploy plugin allows you to automate this for a project including
> its dependencies?
> I hope I do not have to install one bundle at a time via mvn install.
>  
>
>     Variable substitution is not supported yet (it's a good idea by the way,
>     and worth to create a Jira), but you can prepare it at buildtime.
>
>
> Do you want me to open an enhancement request?
>
>     Cave basically provides two things:
>     - Cave repository is interesting for you as it can store any kind of
>     artifacts that you can use in your Karaf instances
>     - Cave Features Gateway is just a "wrapper" of multiple features XML in
>     one big XML. You just do the feature:repo-add of the Gateway XML instead
>     of each individual XML locations. The gateway XML is managed by service.
>
>     Don't hesitate to ping me directly if you need more details or advices.
>
>
> I would like to understand better how I can create a repo and populate
> it with all the bundles in a folder using Cave 4.2.0. I could not figure
> out how to do that from the shell, it looks like this was possible in
> 4.1 but the 4.2 shell is missing some commands that existed before.
> Maybe it is possible to populate a cave repo starting from a feature?
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Few questions about Karaf and Cave

jbonofre
In reply to this post by giamma
Just to let you know that the updated Cave documentation has been
published on website:

http://karaf.apache.org/manual/cave/latest-4/

Regards
JB

On 05/11/2019 13:02, giamma wrote:

> Hello,
>
> I am testing on Karaf an OSGi application that runs successfully in Eclipse
> Virgo, WebSphere Liberty and plain Equinox (bndrun) using Pax Web.
>
> The application is running as expected, and in order to provision it I
> created a XML feature repository file containing several features and
> configurations.
>
> When creating the feature file if I don't or can't use maven URLs, can I use
> variable substitutions in file:// URLs in orther to pickup bundles that I
> copied into a folder, e.g.:
>    
>         file:///${karaf.base}/mybundles/my.bundle.jar
>
> Can I do the same to copy to e.g. ${karaf.etc} additional configuration
> files (<configfile> feature element)?
>
> As an alternative approach, I would like to try OBR, which would make the
> deployment more similar to that of Eclipse Virgo and WebSphere Liberty,
> letting me re-use more of the existing build scripts.
>
> By reading the documentation I understood that:
> 1 - I should install Karaf Cave which provides an OBR repository
> 2 - I should install OBR which will let Karaf resolve bundle requirements
> against Cave
> 3 - I should deploy my top-level bundles either manually or by placing them
> in the OBR repository
>     and by listing them in a feature using an "obr:" URL.
> 4 - required bundle dependencies will be found by OBR in the Cave repository
> and will be deployed for me
>
>
> The Karaf documentation explains how to use Cave and how to create and
> populate a repository, but:
> * - the latest version of Cave, 4.2.0 has completely different shell
> commands, in particular "upload" is gone
> * - Cave 4.2.0 documentation describes a gateway command (don't know if that
> helps) but that command
>      does not show up in the shell even after installing the corresponding
> feature as documented in the guide
>
> With respect to Cave my questions are:
> * - how can I create an OBR repository, populate it, and use it for
> resolution when using Karaf 4.2.7 and
>      Cave 4.2.0? If this is only possible with Cave 4.1.x, will the same
> capability be available in a future
>      Cave 4.2.x or is this deprecated?
> * - is there a way for Cave to monitor the repo folder and auto-update the
> repository.xml (like Virgo and
>      WebSphere do, which do not even use repository.xml) or do I have to
> manually update the
>      repository every time a bundle is changed?
>
> Thanks in advance.
> Giamma.
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Few questions about Karaf and Cave

giamma
Thanks for your support.

On Wed, Nov 6, 2019 at 8:17 AM Jean-Baptiste Onofré <[hidden email]> wrote:
Just to let you know that the updated Cave documentation has been
published on website:

http://karaf.apache.org/manual/cave/latest-4/

Regards
JB

On 05/11/2019 13:02, giamma wrote:
> Hello,
>
> I am testing on Karaf an OSGi application that runs successfully in Eclipse
> Virgo, WebSphere Liberty and plain Equinox (bndrun) using Pax Web.
>
> The application is running as expected, and in order to provision it I
> created a XML feature repository file containing several features and
> configurations.
>
> When creating the feature file if I don't or can't use maven URLs, can I use
> variable substitutions in file:// URLs in orther to pickup bundles that I
> copied into a folder, e.g.:
>     
>         file:///${karaf.base}/mybundles/my.bundle.jar
>
> Can I do the same to copy to e.g. ${karaf.etc} additional configuration
> files (<configfile> feature element)?
>
> As an alternative approach, I would like to try OBR, which would make the
> deployment more similar to that of Eclipse Virgo and WebSphere Liberty,
> letting me re-use more of the existing build scripts.
>
> By reading the documentation I understood that:
> 1 - I should install Karaf Cave which provides an OBR repository
> 2 - I should install OBR which will let Karaf resolve bundle requirements
> against Cave
> 3 - I should deploy my top-level bundles either manually or by placing them
> in the OBR repository
>     and by listing them in a feature using an "obr:" URL.
> 4 - required bundle dependencies will be found by OBR in the Cave repository
> and will be deployed for me
>
>
> The Karaf documentation explains how to use Cave and how to create and
> populate a repository, but:
> * - the latest version of Cave, 4.2.0 has completely different shell
> commands, in particular "upload" is gone
> * - Cave 4.2.0 documentation describes a gateway command (don't know if that
> helps) but that command
>      does not show up in the shell even after installing the corresponding
> feature as documented in the guide
>
> With respect to Cave my questions are:
> * - how can I create an OBR repository, populate it, and use it for
> resolution when using Karaf 4.2.7 and
>      Cave 4.2.0? If this is only possible with Cave 4.1.x, will the same
> capability be available in a future
>      Cave 4.2.x or is this deprecated?
> * - is there a way for Cave to monitor the repo folder and auto-update the
> repository.xml (like Virgo and
>      WebSphere do, which do not even use repository.xml) or do I have to
> manually update the
>      repository every time a bundle is changed?
>
> Thanks in advance.
> Giamma.
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com


--
Gian Maria Romanato
<gm.romanato (at) gmail (dot) com>
Reply | Threaded
Open this post in threaded view
|

Re: Few questions about Karaf and Cave

jbonofre
You are welcome and thanks for the Jira !

Regards
JB

On 06/11/2019 12:08, Giamma wrote:

> Thanks for your support.
>
> On Wed, Nov 6, 2019 at 8:17 AM Jean-Baptiste Onofré <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Just to let you know that the updated Cave documentation has been
>     published on website:
>
>     http://karaf.apache.org/manual/cave/latest-4/
>
>     Regards
>     JB
>
>     On 05/11/2019 13:02, giamma wrote:
>     > Hello,
>     >
>     > I am testing on Karaf an OSGi application that runs successfully
>     in Eclipse
>     > Virgo, WebSphere Liberty and plain Equinox (bndrun) using Pax Web.
>     >
>     > The application is running as expected, and in order to provision it I
>     > created a XML feature repository file containing several features and
>     > configurations.
>     >
>     > When creating the feature file if I don't or can't use maven URLs,
>     can I use
>     > variable substitutions in file:// URLs in orther to pickup bundles
>     that I
>     > copied into a folder, e.g.:
>     >     
>     >         file:///${karaf.base}/mybundles/my.bundle.jar
>     >
>     > Can I do the same to copy to e.g. ${karaf.etc} additional
>     configuration
>     > files (<configfile> feature element)?
>     >
>     > As an alternative approach, I would like to try OBR, which would
>     make the
>     > deployment more similar to that of Eclipse Virgo and WebSphere
>     Liberty,
>     > letting me re-use more of the existing build scripts.
>     >
>     > By reading the documentation I understood that:
>     > 1 - I should install Karaf Cave which provides an OBR repository
>     > 2 - I should install OBR which will let Karaf resolve bundle
>     requirements
>     > against Cave
>     > 3 - I should deploy my top-level bundles either manually or by
>     placing them
>     > in the OBR repository
>     >     and by listing them in a feature using an "obr:" URL.
>     > 4 - required bundle dependencies will be found by OBR in the Cave
>     repository
>     > and will be deployed for me
>     >
>     >
>     > The Karaf documentation explains how to use Cave and how to create and
>     > populate a repository, but:
>     > * - the latest version of Cave, 4.2.0 has completely different shell
>     > commands, in particular "upload" is gone
>     > * - Cave 4.2.0 documentation describes a gateway command (don't
>     know if that
>     > helps) but that command
>     >      does not show up in the shell even after installing the
>     corresponding
>     > feature as documented in the guide
>     >
>     > With respect to Cave my questions are:
>     > * - how can I create an OBR repository, populate it, and use it for
>     > resolution when using Karaf 4.2.7 and
>     >      Cave 4.2.0? If this is only possible with Cave 4.1.x, will
>     the same
>     > capability be available in a future
>     >      Cave 4.2.x or is this deprecated?
>     > * - is there a way for Cave to monitor the repo folder and
>     auto-update the
>     > repository.xml (like Virgo and
>     >      WebSphere do, which do not even use repository.xml) or do I
>     have to
>     > manually update the
>     >      repository every time a bundle is changed?
>     >
>     > Thanks in advance.
>     > Giamma.
>     >
>     >
>     >
>     > --
>     > Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>     >
>
>     --
>     Jean-Baptiste Onofré
>     [hidden email] <mailto:[hidden email]>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
>
>
>
> --
> Gian Maria Romanato
> <gm.romanato (at) gmail (dot) com>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com