You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Hari Madhavan <ma...@gmail.com> on 2017/06/21 16:17:34 UTC

Automatic Upgrade Installer for Karaf

Hi ,

I have developed an automatic upgrade installer , that would always pull
down the latest features from a nexus repository as a night-time scheduled
action. I had initially scripted it in karaf, but then implemented it in
Java using karaf services.

The application is built as a set of features ( 18 to be exact ) and I have
 a summary feature ( my-app feature)  that includes all the other features
, except the upgrade-manager feature which has a self-upgrading as well as
my-app upgrading capability

A few of items are making it difficult to get it to work exactly as I want
- and I wanted to know what could be wrong in my assumption/approach

   1. While most of the features and bundles can be resolved based on
   karaf's resolution schemes , there are a couple of features whose bundles
   should be started only in the end - they depend on some interface bundles
   but work with implementations of the interfaces which should be available
   when they start - however even if these features are listed in the end of
   the feature definition all the bundles are started in alphabetic order.
   Eventually I have used bundle start-level to force these features to start
   last
   2. Sometimes data migration needs to be done for features that are
   upgraded before they are started. So I would prefer to have the feature to
   be installed in stopped mode and then start it after migration. However
   even though I have provided the  Option.NoAutoStartBundles enum option for
   FeatureService.installFeature, the bundles are always started on
   installation .
   3. All the bundles are shutdown before the upgrade to ensure that there
   is no other activity during upgrade. However the very act of shutting down
   the my-app feature , causes many bundles in other features ( including the
   upgrade-manager which is completely isolated from the rest of my-app ) to
   restart themselves. How can this be prevented ?

I am using Karaf 4.0.5 .

I'd really appreciate insights/thoughts on these points.

Regards
Hari

-- 
Hari
9845147731

Re: Automatic Upgrade Installer for Karaf

Posted by Guillaume Nodet <gn...@apache.org>.
2017-06-21 18:17 GMT+02:00 Hari Madhavan <ma...@gmail.com>:

> Hi ,
>
> I have developed an automatic upgrade installer , that would always pull
> down the latest features from a nexus repository as a night-time scheduled
> action. I had initially scripted it in karaf, but then implemented it in
> Java using karaf services.
>
> The application is built as a set of features ( 18 to be exact ) and I
> have  a summary feature ( my-app feature)  that includes all the other
> features , except the upgrade-manager feature which has a self-upgrading as
> well as my-app upgrading capability
>
> A few of items are making it difficult to get it to work exactly as I want
> - and I wanted to know what could be wrong in my assumption/approach
>
>    1. While most of the features and bundles can be resolved based on
>    karaf's resolution schemes , there are a couple of features whose bundles
>    should be started only in the end - they depend on some interface bundles
>    but work with implementations of the interfaces which should be available
>    when they start - however even if these features are listed in the end of
>    the feature definition all the bundles are started in alphabetic order.
>    Eventually I have used bundle start-level to force these features to start
>    last
>
>
You need to use service dependencies and track them using service trackers
in order to get rid of this ordering problem.


>
>    1. Sometimes data migration needs to be done for features that are
>    upgraded before they are started. So I would prefer to have the feature to
>    be installed in stopped mode and then start it after migration. However
>    even though I have provided the  Option.NoAutoStartBundles enum option
>    for FeatureService.installFeature, the bundles are always started on
>    installation .
>
> MMh, I think this only affect newly installed features.  You could try to
stop the feature using FeaturesService.updateFeaturesState , run the
deployer and start them again maybe.

>
>    1. All the bundles are shutdown before the upgrade to ensure that
>    there is no other activity during upgrade. However the very act of shutting
>    down the my-app feature , causes many bundles in other features ( including
>    the upgrade-manager which is completely isolated from the rest of my-app )
>    to restart themselves. How can this be prevented ?
>
> There are 2 different things.  Stopping a bundle and updating a bundle.
Bundles are not stopped by the deployer unless an update or a refresh is
required.  Try with the --verbose flag to get an idea about why bundles are
refreshed.


> I am using Karaf 4.0.5 .
>
> I'd really appreciate insights/thoughts on these points.
>
> Regards
> Hari
>
> --
> Hari
> 9845147731 <(984)%20514-7731>
>



-- 
------------------------
Guillaume Nodet