UNOMI-919: Refactor the UNOMI startFeatures configuration to use a Karaf feature #741
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors how Apache Unomi selects and installs its startup feature set (formerly driven by the
startFeaturesOSGi configuration and the semantic overloading ofUNOMI_AUTO_START). It introduces proper Karaf features to represent Unomi “distributions” (search backend variant + ancillary feature set) and restoresUNOMI_AUTO_STARTto its original purpose (auto–start true/false). A new environment variable and/or setup mechanism is added to select the desired search backend distribution cleanly and persistently.It also removes the HealthCheck delegator introduced earlier and reverts to the standard pattern of provider activation via configuration, now split per backend through dedicated healthcheck features.
Motivation
The previous approach:
UNOMI_AUTO_STARTto include backend selection (e.g.elasticsearch | opensearch) which was confusing to new users.startFeatures) holding a comma–separated list of features, duplicating what Karaf feature descriptors already provide (dependency management, versioning, externalization).This PR adopts standard Karaf feature mechanisms for clarity, maintainability, and easier custom packaging, while simplifying health checks.
Key Changes
Distribution Feature Introduction
unomi-distribution-elasticsearchunomi-distribution-opensearchdistributionhousing the built-in feature XML descriptors (included in the package).Environment Variable / Setup Refactor
UNOMI_AUTO_STARTto a boolean/legacy behavior (e.g. auto-start service on container launch).UNOMI_DISTRIBUTIONto specify which distribution feature to use (defaults to Elasticsearch if unset).UNOMI_DISTRIBUTIONinto an internalunomi:setuppersisted value.unomi-distribution-elasticsearchif not set in environmentunomi:setup <distributionFeatureName>command:Removal of Custom
startFeaturesOSGi ConfigstartFeaturesOSGi config key and associated management logic fromUnomiManagementService.HealthCheck Simplification
unomi-healthcheck-elasticsearch,unomi-healthcheck-opensearch).init()to avoid unnecessary client construction when not active.Docker & Packaging Adaptations
UNOMI_DISTRIBUTION.UNOMI_AUTO_STARTfor backend selection.UNOMI_AUTO_START=trueUNOMI_DISTRIBUTION=unomi-distribution-opensearch(or elasticsearch).Upgrade / Migration Notes
If you previously used Unomi Docker images with:
(or
opensearch)You must now use:
(or
unomi-distribution-opensearch).If you previously started Unomi in Karaf shell with:
(or
opensearch)You must now use:
(or
unomi-distribution-opensearch).Custom startup feature lists should be converted into a Karaf feature XML and published as a Maven artifact; then set
UNOMI_DISTRIBUTIONto that feature name.Testing Performed
UNOMI_DISTRIBUTIONvalues.UNOMI_DISTRIBUTIONdefaults to elasticsearch.Related JIRA / PR Links