Friday, July 29, 2011

Virgo and the Cloud

If you wanted to try your OSGi based applications in the cloud you can now do so with Eclipse Virgo and CloudFoundry using a VM image.

What you will need:

The image comes with pre-installed Ubuntu 11.04 and has:
  • User / Password: virgo / cloudfoundry
  • CloudFoundry
    • installation: /home/virgo/cloudfoundry
    • version/date: 28 July 2011
    • Virgo 3.0.0.RC1
  • Applications (Splash screen & Admin Console): /home/virgo/apps

Starting CloudFoundry
To start CloudFoundry you have to start a Terminal and issue:
cd ~/cloudfoundry/vcap
bin/vcap start
To check if the start was successful:
bin/vcap status
 More information and examples can be found in the CloudFoundry VCAP Readme.


Sample applications
To push (deploy) the Virgo default applications you can use the VMC client:
cd ~/apps
vmc push virgo

where "virgo" is the name of the application we want to have running on CloudFoundry. You will have to confirm the name, URL, memory reservation and that the default applications do not use services.

As next step you can request the application at http://virgo.vcap.me. This should bring the default splash screen of Virgo with a link to the Admin Console.


Your own applications
Perhaps you will want to try your own application as well. To do this you will have to:
  • create a directory
  • copy your stuff inside
  • push the content with "vmc push"

There are some extras here. If you create "repository" directory inside your application's directory then the content of this repository will be copied in Virgo's repository. 

Virgo on CloudFoundry
If you take a look at the provided Admin Console application you will see that it makes use of two bundles that are located inside "repository/ext". The bundles are copied in Virgo's own repository directory so the rest of the content can resolve against these bundles.


Supported artefacts
Currently supported artefacts:
  • WAR file (defaults to Tomcat, so you'll have to change the framework to Virgo)
  • PAR
  • Plan
  • Bundle (JAR)
  • Combination of the mentioned artefacts


Multi-application solutions
The last option provides you with the ability to have more than one artefact in your solution. All these are pushed to CloudFoundry and used in Virgo. 

As an example you may have several interconnected but relatively independent applications: PAR representing some back-end, WAR that provides the end-user UI and some more artefacts (as much as you need) that can represent editors or administration logic.

Everything can run on one Virgo server for testing/development, but you may decide to create several instances of a certain component to scale out that part of your solution. All that provided that your applications are written with scalability and cloud computing in mind of course.


Where's the source code?
At the time of this writing the changes made to CloudFoundry are not final and therefore no pull request is created, but I'm up to this.

You can find the source in GitHub if you want to play with it or just check how/if it works in your case :)

    id_rsa.pub: invalid format, error in libcrypto

    After I upgraded my Linux and got Python 3.10 by default, it turned out that Ansible 2.9 will no longer run and is unsupported together with...