Consul is a distributed data store, it is similar to tools like etcd or zookeeper, but unlike those stores it is specifically targeted at service discovery.

In a nutshell, Consul can be deployed to a cluster of services, and you can register and deregister services, which will propagate over the cluster.

Additionally, you can add ‘checks’ to a service registration (for example a HTTP call), which Consul will monitor. If the checks fail, the service will be retracted from the store.

So there is two things we need to do here to make our setup work on multiple hosts:

  • On every host, read the Docker API, but instead of injecting it into OSGi configuration directly, register the services into Consul.
  • In every OSGi instance monitor Consul, and dynamically inject and retract the configuration objects in OSGi.

So this means that we have split the original Docker -> OSGi bridge into two parts:

  • Docker -> ConsulCluster … … ConsulCluster -> OSGi

I’ve made a (quite rough) version here:

Comments or pull requests are very welcome.

Reach me at: or @lyaruu on twitter

Next: Future work