Jeroen van Grondelle

Flower

Posts Tagged ‘OSGi’

5th Dutch Eclipse DemoCamp

Yesterday, the guys at Industrial TSI organized the fifth Dutch Eclipse DemoCamp.

Marcel and I presented an Eclipse version of our Beyond OSGi Software Architecture presentation, focussing on its relation to “typical Eclipse usage” of OSGi, based on plugins and extension points.





It was a great meeting. Good presentations and some time left for meeting other dutch Eclipse users. SeeĀ Maarten Meijer’s blog for an impression.

OSGi in the Cloud

Running an OSGi container in a public cloud service, such as GoGrid.com, is the ultimate proof of the Scale Invariance promised in our Beyond Software Architecture presentation. Reason enough for Marcel Offermans and myself to give it a try and deploy our software on EC2.

Our goal is to us a standard EC2 image and run Java and an OSGi framework on it, through the use of PAXRunner. We will install software bundles onto the instance later, by a provisioning mechanism.

Subscribing

Go through the standard subscription process at aws.amazon.com and create an EC2 account. When completed, do three things.
- Add SSH port 22 to the default security group;
- Create a Private/Public Keypair;
- Download your Private Key, as you’ll need it to connect to your images

Choosing an AMI

At this stage, we are using a standard Ubuntu 9.04 AMI, provided by alestic.com (AMI ID: ami-ccf615a5).

Launch an instance and connect to it using SSH:

local> ssh -i EC2.pem root@ec2-a-b-c-d.amazonaws.com

Enable multiverse repositories by editing /etc/apt/sources.list. Add these four lines at the end (for EC2′s US-EAST cloud).

deb http://us.ec2.archive.ubuntu.com/ubuntu/ jaunty main multiverse
deb-src http://us.ec2.archive.ubuntu.com/ubuntu/ jaunty main multiverse
deb http://us.ec2.archive.ubuntu.com/ubuntu/ jaunty-updates main multiverse
deb-src http://us.ec2.archive.ubuntu.com/ubuntu/ jaunty-updates main multiverse

Update the APT database:

ec2> sudo apt-get update

Install java

Install Sun’s Java 6 JDK using APT:

ec2> sudo apt-get install sun-java6-jdk

Run an OSGi Framework using Pax Runner

A great way of installing and running an OSGi framework is using PAX Runner. PAX Runner transparently downloads and runs for you all major OSGi implementations.

Download and unarchive PAX Runner.

ec2> curl http://repo1.maven.org/maven2/org/ops4j/pax/runner/pax-runner-assembly/1.3.0/pax-runner-assembly-1.3.0-jdk15.tar.gz > pax-runner-assembly-1.3.0-jdk15.tar.gz
ec2> tar xzf pax-runner-assembly-1.3.0-jdk15.tar.gz

Installing and starting an OSGi Framework can be done by running PAX Runners shell script. By adding the URL of a bundle as a parameter, this bundle will be downloaded and started.

ec2> ./pax-runner-1.3.0/bin/pax-run.sh http://www.vangrondelle.com/code/hellocloud_1.0.0.jar
__________                 __________                                 
\______   \_____  ___  ___ \______   \__ __  ____   ____   ___________
|     ___/\__  \ \  \/  /  |       _/  |  \/    \ /    \_/ __ \_  __ \
|    |     / __ \_>    <   |    |   \  |  /   |  \   |  \  ___/|  | \/
|____|    (____  /__/\_ \  |____|_  /____/|___|  /___|  /\___  >__|   
               \/      \/         \/           \/     \/     \/       
 
Pax Runner (1.3.0) from OPS4J - http://www.ops4j.org
----------------------------------------------------
 
 -> Using config [classpath:META-INF/runner.properties]
 -> Using only arguments from command line
 -> Scan bundles from [http://www.vangrondelle.com/code/hellocloud_1.0.0.jar]
 -> Scan bundles from [scan-bundle:http://www.vangrondelle.com/code/hellocloud_1.0.0.jar]
 -> Provision bundle [http://www.vangrondelle.com/code/hellocloud_1.0.0.jar, at default start level, bundle will be started, bundle will be loaded from the cache]
 -> Preparing framework [Felix 2.0.1]
 -> Downloading bundles...
 -> http://www.vangrondelle.com/code/hellocloud_1.0.0.jar : 1078 bytes @ [ 359kBps ]
 -> Using execution environment [J2SE-1.6]
 -> Runner has successfully finished his job!
 
 
Welcome to Felix
================
 
Hello Cloud!
->

As you see, Felix is installed by default. Different OSGi implementations can be run by adding the --platform equinox|knopflerfish flag. Even the version to be installed can be specified.

Turning all this into a bootstrap script

For easy launching, you could add all this into a bootstrap script that turns a default Ubuntu image into an OSGi server with a single command.

Turning the Java installation into a silent install requires some additional scripting.

You can now install and run a bundle using the following command.

ec2> curl www.vangrondelle.com/code/bootstrap.sh | sh

This script needs some enhancements: Multiverse repositories are added everytime its run for now. Script might detect EC2 Zone and add appropriate repositories.

Beyond OSGi Software Achitecture

November 12th, 2009, Marcel Offermans and I presented on JFall ’09, the Dutch Java User Group Conference.

We presented a container-oriented software architecture that helps dealing with change. Most people expect functionality to change, but especially changing non-functional requirements can be tough on a software architecture: Changing scale affects transaction volumes, supported platforms, but also requirements on management interfaces, installation and provisioning of software and security.

In our talk, we stress that anticipating change is not the same as early over dimensioning for possible future requirements. Think BIG, act small, by designing future proof interfaces, while implementing in a pragmatic way todays requirements.

Our software architecture is based on the OSGi Services Model and uses declarative dependency management for creating composite services and manage the lifecycle of these services. We present a number of patterns for the types of relations between components in such a container oriented architecture.






Updated: Read an impression at this dutch blog.

Updated again: See the video of the presentation at http://lsd.luminis.nl/online-video-beyond-osgi-software-architecture/