Provisionning with Fabric

Already, one month since my last blog entry, but time as been flying with the birth of my son Arthur a few weeks ago. I'd like to talk about the provisioning mechanism of Fabric a bit.

In my last post, I explained how configuration was done through the use of ZooKeeper as the repository for configurations and profiles, propagated to various bundles using the OSGi ConfigurationAdmin service. The provisioning mechanism in Fabric is based on this mechanism: the fabric-agent bundle receives its configuration through the org.fusesource.fabric.agent pid and will automatically update bundles as needed. The nice thing is that the configurations are computed using an overlay mechanism which means that the list of bundles or features to deploy will come from the various profiles a give node has been assigned.

The agent itself supports several kinds of informations:
  • bundles that need to be installed
  • karaf features that need to be installed
  • repositories for karaf features
  • a url pointing to the osgi framework to use
  • system properties
  • osgi framework properties

An example of defining such profiles can be found in the fabric example.

The agent will use those informations and delegate to an internal OSGi resolver to compute the actual list of bundles to deploy. It will then compare this list to the list of bundles already installed and resolve the differences by installing / updating / uninstalling bundles. The agent is able to upgrade all bundles, including core Karaf bundles and even the OSGi framework itself and framework properties.

The profile notion I explained in my previous blog entry allow the use of profiles for provisioning and configuration. For example, a profile can be defined for deploying ActiveM or Camel. And remember one can override profiles, so you can define a profile for your application and change the IP of the ActiveMQ broker in overridden profiles based on the geographic location to connect to the nearest broker.

Due to the configuration bridge between the OSGi Configuration Admin and ZooKeeper, any change made into the zookeeper tree will be reflected to the provisionning agent and the bundles updated immediately. This may or may not be a desired behavior and that's one of the reason why the ZooKeeper tree used by Fabric has a notion of versions. But that'll be explained in a follow up entry.

Comments

Popular posts from this blog

SSH Server in Java

ServiceMix Kernel is a small container based on OSGi. The latest release allows external clients to connect to it and issue commands using a simple protocol implemented on top of TCP or SSL. However, this remoting protocol has some drawbacks as the internals makes it unable to do another remote login from a remote session. In addition to that, completion and history do not really work great. So I've been thinking about using the SSH protocol, which is widely used, secured, with tons of different clients available. Unfortunately, no SSH server is available in Java. Over the past weeks, I've been working on implementing this SSH server, based on the IEFT specifications, the JSch SSH client library, and the OpenSSH server source code. The server itself is based on Apache Mina which is a great framework for using NIO. The project is available at http://code.google.com/p/sshd/ and although there are lots of limitations right now, the basics of the SSH protocol work. I plan t...

Apache Karaf

ApacheCon was really interesting this year! Recently, a lot of people have expressed a real interest in ServiceMix Kernel , our generic OSGi distribution for server side applications. We've been discussing moving this subproject into Apache Felix for several reasons: raise the visibility and awareness on ServiceMix Kernel attract a broader community Several Apache projects are planning to use ServiceMix Kernel as their container: this includes Apache James , Apache Directory and Apache ActiveMQ . The Apache Sling community is also willing to contribute to this effort along with some other groups like the OPS4J project. During this discussion, a name as been proposed by Jamie Goodyear: Apache Karaf . A carafe is a small container used for serving wine and other drinks (http://en.wikipedia.org/wiki/Carafe). In similarity to the name the Kernel allows applications to be more easily handled, and improves their characteristics (much like a bottle of wine left to breath in a dec...

Camel Endpoint DSL

Camel Endpoint DSL One of the new features of Camel 3.0  is an Endpoint DSL.  This new API aims to provide a type safe replacement for the URLs that are used in Camel to designate the consumer or producer endpoints.  These URLs provide 3 things: the scheme of the URL identifies the component to use, a unique name or id for the endpoint, and a set of parameters to customize the endpoint behavior. Here is an example of an FTP consumer endpoint definition: from( "ftp://foo@myserver?password=secret& recursive=true& ftpClient.dataTimeout=30000& ftpClientConfig.serverLanguageCode=fr" ) .to( "bean:doSomething" ); There are several drawbacks with such constructs : no type safety, bad readability and no simple completion. So we now use the meta model, which is currently extracted from the source using an annotation processor and written in various JSON files, to generate a fluent DSL for each endpoint.  The same...