Issue reproduction steps and samples for use with Karaf 4.1.1 and Cellar 4.1.0 regarding config sync.
-
Download the Karaf 4.1.1 zip and unzip two separate distributions. Name them
karaf-4.1.1_C1
andkaraf-4.1.1_C2
respectively. -
From the
configs/etc
directory of this repo, dropkaraf.management.cfg
andkaraf.shell.cfg
into theetc
directory of onlykaraf-4.1.1_C2
. -
In two separate terminal windows, boot up both instances of Karaf. For C2's terminal session, if
KARAF_DEBUG
is set, you have two options:- Run
unset KARAF_DEBUG
- Modify the debug port in relevant scripts found in
<KARAF_HOME>/bin
- Run
-
On both nodes, do the following:
- download and deploy org.apache.felix.utils-1.10.0.jar before installing Cellar.
- Run
feature:repo-add cellar
- Run
feature:install cellar
- In
etc/org.apache.karaf.cellar.node.cfg
, set theconfig.listener
property totrue
- Run
log:set TRACE org.apache.karaf.cellar.config
_Note: Do a
bundle:list
and check if the cellar bundle for feature sync got installed. If not, you likely forget to deployorg.apache.felix.utils-1.10.0.jar
for one or both of the nodes. Omitting this step breaks Cellar: feature sync won't work because the bundle won't install, hence the synchronizer won't be found, and configurations will not replicate. -
In this repo, consider the
blueprint.xml
file undersrc/main/resources/OSGI-INF/blueprint
. Build this project twice:- Once using the managed-service-factory configuration with the
<bean>
and<service>
commented out (default). - Again using the singleton service configuration with
<cm:managed-service-factory ...>
commented out.
Note: It is highly recommended that the JARs are renamed appropriately. Our artifacts were:
cellar-msf-testing-1.0-FACTORY
cellar-msf-testing-1.0-SINGLETON
- Once using the managed-service-factory configuration with the
This validates that basic service configuration replication works as expected.
- Drop the SINGLETON artifact into both nodes'
deploy
directories. - On both nodes, ensure the bundle is Active in
bundle:list
, then tail the logs. - An INFO log should appear approximately once every 5 seconds. The name should be "NAME_FROM_BLUEPRINT".
- Consider the config file in this repo:
configs/service-singleton/com.connexta.cellar.LogLoopImpl.cfg
, which contains a name property set to "NAME_FROM_CONFIG".- Only on node C1, drop a copy of the config into
etc
. - Verify on both nodes that the INFO log changed from "NAME_FROM_BLUEPRINT" to "NAME_FROM_CONFIG".
- Verify on both nodes that
etc/com.connexta.cellar.LogLoopImpl.cfg
is present and has name="NAME_FROM_CONFIG". - Only on node C2, change the name in the config file to something else (i.e. "ANOTHER_NAME_FROM_CONFIG"). Save the file.
- Verify on both nodes that the INFO log changed from "NAME_FROM_CONFIG" to "ANOTHER_NAME_FROM_CONFIG".
- Verify on both nodes that
etc/com.connexta.cellar.LogLoopImpl.cfg
is present and has name="ANOTHER_NAME_FROM_CONFIG".
- Only on node C1, drop a copy of the config into
This validates that factory configuration replication does not work as expected.
-
Remove the SINGLETON artifact from both nodes'
deploy
directories and ensure they no longer show up inbundle:list
. -
Drop the FACTORY artifact into both nodes'
deploy
directories. -
Consider the config file in this repo:
configs/service-factory/com.connexta.cellar.LogLoopImpl-01.cfg
, which contains a name property set to "NAME_FROM_CONFIG_01".- Create several copies incrementing the numeric components of the filename and internal name property.
- Only on node C1, drop config file
01
intoetc
. - Verify on node C2 that the service instance was not replicated, as no logs are being generated.
- Only on node C2, drop config file
02
intoetc
. - Verify on node C1 that the service instance was not replicated, as only logs from
config file
01
are visible.
Note: As of this repo's current state, deleting the configs from
etc
or even stopping/uninstalling the bundle will not clean up the logging threads. Karaf needs to be rebooted.