If:
I have a bundle I wish to run on n OSGi containers exporting some service;
I am using DS to register the modified method for when configuration changes, so I can update the service via ConfigurationAdmin, and to export the interfaces remotely as per RFC119;
I am using Discovery to call those services from other bundles on other boxes,
is it possible to have a central configuration for this service using ConfigurationAdmin, so that I can publish a configuration change via the Configuration Admin and it is received by all instances of the service running?
It seems from everything that I have read that ConfigurationAdmin is not network aware, and is local to each OSGi container?
Thanks for your insight in advance :)
So your bundle runs on N containers, exports its service to that local container only, and it exports ManagedService using remote services to publish it to some "central" container that has ConfigurationAdmin running?
You are right that ConfigurationAdmin is not network aware, but if the bundle remotely publishes its ManagedService to that container running Configuration Admin it should work. The only caveat is that each ManagedService must have a unique service PID so you cannot simply publish the same bundle in N containers unless you ensure that each instance ends up using a unique PID.
You should probably check out Karaf Cellar. It provides cluster support for OSGi applications and synchronizes configuration changes across nodes.
Related
there are several instances of applications that interact with each other (microservices)
There are docker images of these spring boot apps
Is it possible to use these docker images in test container to deploy in tests and how is it possible to do this
There is no need to take into account the time to work and initialization of such tests, this is not the main thing in this situation.
Testcontainers offers GenericContainer which allow you to use images in the registry. For example, let's say you have a image for your service called myorganization/greetings-service:2.0.0 which listen request in the port 8080. Then you can use:
GenericContainer container = new GenericContainer("myorganization/greetings-service:2.0.0")
.withExposedPort(8080)
.waitingFor(Wait.forHttp("/"));
and later you can get the host and port using container.getHost() and container.getMappedPort(8080).
Hope this can help you
Let's say I have started to use the spring-cloud-config-server and get it working (using a git repository in background). So now I will deploy that config-server on a cluster (mesos cluster or AWS cloud etc.)
So for reliability etc. I would like to start two instances of the same config-service within a cluster. By using a service registry all other services can now connect to that config-server and get their configuration.
But the question: How can the synchronisation between those config-servers being handled... So for example If I change the configuration in the git repository and now there is some lack of time between both instance will deliver the exact same information...
Does there exist a solution for that ? Some kind of a raft census protocol / setup etc. ? Or is there the only solution not to use spring-config-server and use etcd instead or other solutions ?
Update:
It might be an option to make a fore-update option for the git repositories. This makes sure to get the most recent state with the drawback of performance.
In Spring Cloud Services v3.1.2 and later, you can use the periodic parameter when configuring a Config Server service instance to cause the mirror service to automatically refresh a Git repository mirror periodically
pcf link
In order to make an OSGI service to be remotely accessible, I'd like to use ActiveMQ JMS broker as a distribution provider inside ECF framework. Which steps should I take?
I'll be answering my own question in order to document it.
Get a minimal working ECF remote service workspace, with ecf.generic.server as the distribution and one of the discovery providers (zookeeper for example). You can use http://wiki.eclipse.org/EIG:Getting_Started_with_OSGi_Remote_Services tutorial.
Install an ActiveMQ broker with default configuration.
Download the JMS/ActiveMQ ECF providers from https://github.com/ECF/JMS. Add the org.eclipse.ecf.provider.jms and org.eclipse.ecf.provider.jms.activemq projects in your workspace, build and add them to your run configuration or target platform.
For the provider service properties, do the following changes:
a. Change the "service.exported.configs" property for as "ecf.jms.activemq.tcp.client"
b. Add "ecf.endpoint.connecttarget.id" property with the following value "tcp://[ACTIVEMQ_IP]:61616/rs_topic", replacing [ACTIVEMQ_IP] with the broker IP. You can also change the topic name as something related to your service.
Now we also need a ActiveMQ JMS Server Container. Add the following code to the provider side. Use the Activator or fire up a new component with DS. You can also get an IContainerFactory object from the service registry.
IContainerFactory containerFactory = ContainerFactory.getDefault();
containerFactory.createContainer("ecf.jms.activemq.tcp.manager",
new Object[] { "tcp://[ACTIVEMQ_IP]:61616/rs_topic" });
I'm trying to provide a remote declarative service using Eclipse ECF.
In the service provider component definition, I have set the following properties:
service.exported.interfaces = *
service.exported.configs = ecf.generic.server
ecf.generic.server.id = ecftcp://localhost:3787/server
However I can't figure out how to discover the service using these properties from the consumer side.
(I want to be able to provide the service from one osgi environment and discover it from another osgi.)
Discovery will run automatically if you have specified "service.exported.interfaces". For this to work you need to have the ECF discovery bundles installed in both your targets. On top of this you have to choose a discovery provider. Like SLP, JmDNS or Zookeeper.
Please note that some discovery providers need additional properties to run correctly. For example if you have a double network you need to specify in the JmDNS provider on which network the discovery has to listen.
Make sure that the ECF distribution bundle is started. This does not start automatically.
In a distributed setup, how do I programatically start containers?
More specifically, does there exist any API similar to deploying and undeploying streams for setting up and tearing down containers?
There is currently no way to do this via an API. Containers are only known to the cluster after they are started. Upon initialization, the container registers itself with ZooKeeper. Running a container requires XD to be installed on that host which is currently a manual process: download,unzip,configure, as is starting the container. Some automation of operations will likely be provided in a future release.