Reputation:
I'm wondering if I can configure an OSGi container like Karaf (or any other popular ones) to download bundles (.BNDs) from a remote repository hosted on another machine, via any networking mechanism out there (RMI, HTTP, URLClassLoader, etc.)?
Ideally, I'd be able to deploy new versions of my bundles to this remote repo at any time, and somehow have that trigger the OSGi container "downloading" (installing/deploying) the remote bundles and hot-deploying them over older versions of the same bundle.
Is this possible? If so, how? Thanks in advance!
Upvotes: 0
Views: 1416
Reputation: 5285
I recommend taking a look at the provisioning of Karaf at documentation for provisioning. Your able to deploy bundles either with maven urls, http or file references. Or you might deploy your set of bundles either as a feature definition (which loads all required and used bundles from a maven repo) or by deploying a kar file.
Upvotes: 0
Reputation: 15372
OSGi has an API for managing OSGi frameworks on the BundleContext that every bundle activator receives. This API allows you to install/update a bundle via URL or InputStream.
Since this is a standardized API there have been lots of people making bundles that provide a policy around this deployment process. The archetypical one is Apache FileInstall, it watches a directory and automatically installs every bundle found in this directory and uninstall the bundle when it is gone. This works well with for example dropbox. It also supports configuring via the the Configuration Admin service. On the other hand of the spectrum you find Apache Ace which provides a remote management system.
To find the best solution, try to enlist the requirements you have. One or two systems or 1 million? Local or remote over slow lines?
One thing is for sure, you will find some project or provider being able to provide you with an OSGi bundle that implements your desired management policy.
Upvotes: 1
Reputation: 1
We use Apache Felix and maintain an OBR repository. Once set up you can deploy new versions from the OSGi shell. This does require you to manually log in and enter the command, for example deploy com.example.foo
.
Alternatively you can install directly from urls, like install http://example.com/bundles/bundle.jar
.
Your last requirement (auto deploy) is trickier. You could perhaps enable a remote shell on your OSGi container and as part of your build push the commands via telnet.
Upvotes: 0