Skip to content

KARAF-6207, bootFeatures sometimes being ignored#791

Merged
jbonofre merged 1 commit intoapache:karaf-4.2.xfrom
lkiesow:karaf-6207-bootFeatures
Mar 26, 2019
Merged

KARAF-6207, bootFeatures sometimes being ignored#791
jbonofre merged 1 commit intoapache:karaf-4.2.xfrom
lkiesow:karaf-6207-bootFeatures

Conversation

@lkiesow
Copy link
Contributor

@lkiesow lkiesow commented Mar 23, 2019

According to the documentation, the maven-karaf-plugin will install
features listed in the installedFeatures in the "system" internal
repository. Features listed in bootFeatures are additionally added to
the boot-features in the features service configuration file.

Hence, the configuration options do not conflict and a configuration
like this should result in the features being installed and added to the
boot-features configuration:

<configuration>
  <bootFeatures>
    <feature>foo</feature>
  </bootFeatures>
  <installedFeatures>
    <feature>foo</feature>
  </installedFeatures>
</configuration>

In fact, the configuration should be equivalent to foo being listed
just as a bootFeature.

But what actually happens is that the installedFeature will overwrite
the bootFeature and the feature is not added to the boot-features
configuration.

This patch switches the handling of bootFeatures and installedFeatures
which makes a feature configured in both sections a bootFeature,
adhering to the specifications of both configurations.

According to the documentation, the maven-karaf-plugin will install
features listed in the installedFeatures in the "system" internal
repository. Features listed in bootFeatures are additionally added to
the boot-features in the features service configuration file.

Hence, the configuration options do not conflict and a configuration
like this should result in the features being installed and added to the
boot-features configuration:

    <configuration>
      <bootFeatures>
        <feature>foo</feature>
      </bootFeatures>
      <installedFeatures>
        <feature>foo</feature>
      </installedFeatures>
    </configuration>

In fact, the configuration should be equivalent to `foo` being listed
just as a bootFeature.

But what actually happens is that the installedFeature will overwrite
the bootFeature and the feature is not added to the boot-features
configuration.

This patch switches the handling of bootFeatures and installedFeatures
which makes a feature configured in both sections a bootFeature,
adhering to the specifications of both configurations.
lkiesow added a commit to lkiesow/opencast that referenced this pull request Mar 24, 2019
This patch extracts some core features into separate Karaf features.
These features are installed by default, but not started by default.
This means that they can be easily enabled but will not launch
regardless of users needing those features or not.

The idea behind this is to extract modules used by just a few users to
minimize the code which is running by default, needing less resources,
booting up faster and also minimizing the risk for security
vulnerabilities.

This patch extracts the Moodle and Sakai user provider as an example.
More modules may follow.

Long-term, it may make sense to still boot all features in the
development distribution to ensure they are not easily broken without
someone noticing. That will be easier once KARAF-6207 is fixed:

- apache/karaf#791
@jbonofre
Copy link
Member

It's one or the other: it doesn't makes sense to have the foo feature in both installed and boot features. If you put in boot feature, it's implicitly in the system folder as well.

@jbonofre
Copy link
Member

I consider that you configuration is not correct as it's "exclusive": the feature should be ONLY in boot, installed or startup.

@lkiesow
Copy link
Contributor Author

lkiesow commented Mar 24, 2019

Hi @jbonofre,
thanks for taking a look at this.

The configuration makes sense for a use case where you have a parent pom specifying all features which should be installed and then different child poms specifying specific features to boot up (but leaving the option to start the others):

parent
 |   installedFeatures: foo, bar, …
 +-child1
 |     bootFeatures: foo, …
 +-child2
 |     bootFeatures: bar, …

That makes sense because the documentation I found specified a bootFeature as an installedFeature which also gets an entry in the boot-features configuration. I didn't find any documentation of your claim that the feature configuration is meant to be exclusive.

In any case, if you decide to make this exclusive, can you document that and (probably more important) make the maven-karaf-plugin throw an error and fail in such a case? Because right now the feature configurations are also not exclusive in the code. In the code, the behavior is that the installedFeature configuration takes precedence over the bootFeature configuration.

lkiesow added a commit to lkiesow/opencast that referenced this pull request Mar 24, 2019
This patch extracts some core features into separate Karaf features.
These features are installed by default, but not started by default.
This means that they can be easily enabled but will not launch
regardless of users needing those features or not.

The idea behind this is to extract modules used by just a few users to
minimize the code which is running by default, needing less resources,
booting up faster and also minimizing the risk for security
vulnerabilities.

This patch extracts the Moodle and Sakai user provider as an example.
More modules may follow.

Long-term, it may make sense to still boot all features in the
development distribution to ensure they are not easily broken without
someone noticing. That will be easier once KARAF-6207 is fixed:

- apache/karaf#791
@jbonofre
Copy link
Member

Yes, that's an implicit assertion. We should check that a feature doesn't appear in installed, boot, startup (it's only one). I will do the change.

@jbonofre
Copy link
Member

Waiting for the "exclusive" check, I'm merging your PR.

@jbonofre jbonofre merged commit e6ba080 into apache:karaf-4.2.x Mar 26, 2019
lkiesow added a commit to lkiesow/opencast that referenced this pull request Mar 28, 2019
This patch extracts some core features into separate Karaf features.
These features are installed by default, but not started by default.
This means that they can be easily enabled but will not launch
regardless of users needing those features or not.

The idea behind this is to extract modules used by just a few users to
minimize the code which is running by default, needing less resources,
booting up faster and also minimizing the risk for security
vulnerabilities.

This patch extracts the Moodle and Sakai user provider as an example.
More modules may follow.

Long-term, it may make sense to still boot all features in the
development distribution to ensure they are not easily broken without
someone noticing. That will be easier once KARAF-6207 is fixed:

- apache/karaf#791
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants