I’ve been investigating lately what to do with a bundle, once it’s released:
- Should I automatically deploy it into a Staging or Production server ?
- Should I deploy it into another repository and then use Felix Web Console to deploy it manually ?
Automation is always good, but in conditions where before reaching Production there is a Staging / Pre-production environment, the #1 option doesn’t seem to fit. Therefore I’ve been looking on solutions for #2.
The idea that attracted me the most was to use an OBR ( OSGI Bundle Repository ). Felix Web Console has already an OSGI Repository section, which can connect to a remote OBR and let admin users install OSGI bundles right from the administration page.
I’m going to describe what I’ve done in order to achieve this.
- Create an empty OBR.
For this I configured a new subdomain : obr.mydomain.com, in one of my development machines. I’ve linked the subdomain to
In that folder I’ve created an empty repository.xml file
vi repository.xml <repository name='MediaCenter Bundle Repository'> </repository>
I’ve then checked that I can open the XML file from the browser:
- Configure Maven to deploy the bundle into the OBR, during a Maven Release.
mvn -Dresume=false release:prepare release:perform \ -Darguments="-DremoteOBR=my-obr \ -DobrDeploymentRepository=my-obr::default::file:///var/www/html/obr/ \ -DprefixUrl=http://nexus.mydomain.com/nexus/content/repositories/releases"
If you’ve performed a maven release before, release:prepare and release:perform should be familiar to you. I’ll explain the other options.
- -DremoteOBR – it’s an ID I gave to the OBR repository.
- -DobrDeploymentRepository – defines the OBR repository: OBR_ID::layout::url .
I’ve used the “default” layout and the URL points to a local file, b/c Jenkins who executes the maven command runs on the same machine with the OBR.
- -DprefixUrl – it’s the prefix used in the URL to the JAR bundle. Without this prefix the URL would look like “file:/com/x/y/myBundle.jar” and people won’t the able to download the actual bundle.
I’ve then pointed my prefix to the Nexus Maven repository. During the maven release the bundle is deployed in that Nexus repository anyway, so I’v added it as a prefix for my bundle. With the prefix the URL looks like “http://nexus.mydomain.com/nexus/content/repositories/releases/com/x/y/myBundle.jar”.
- After a maven release, check if the OBR contains the update. Open the URL
again and the information should be there. Here is a sample repository.xml:
<repository name="MediaCenter Bundle Repository" lastmodified="20120627090431.258"> <resource id="org.mediacenter.authentication/1.18.0" symbolicname="org.mediacenter.authentication" presentationname="Media Center Authentication" uri="http://nexus.crestin.tv/nexus/content/repositories/releases/org/mediacenter/authentication/1.18/authentication-1.18.jar" version="1.18.0"> <description>This bundle is a fragment attached to the Sling FormAuth bundle and provides a simple customized login form. </description> <size>6362</size> <category id="mediacenter"/> <capability name="bundle"> <p n="symbolicname" v="org.mediacenter.authentication"/> <p n="presentationname" v="Media Center Authentication"/> <p n="version" t="version" v="1.18.0"/> <p n="manifestversion" v="2"/> </capability> <capability name="fragment"> <p n="host" v="org.apache.sling.auth.selector"/> <p n="version" t="version" v="0.0.0"/> </capability> <require name="bundle" filter="(&(symbolicname=org.apache.sling.auth.selector))" extend="true" multiple="false" optional="false">Required Host org.apache.sling.auth.selector</require> </resource> </repository>
- Go into the Felix Web Console, into the OSGI repository and add
as a new repository.
Where to go from here: