Deploying RAP Applications Made Simple – Introducing the Virgo RAP Server

February 24, 2014 | 3 min Read

Yes, we love building modular web applications, if they just were easier to deploy on a server! Wrapping OSGi applications in WAR files, apparently still the most popular deployment option for RAP, results in a complicated setup: a web app containing an OSGi runtime together with all bundles, configuration, and a bridge servlet that delegates requests to the embedded OSGi - that’s hard to build, hard to change, and hard to debug. Why can’t we just throw our application bundles into a webserver and simply turn it on?

Actually, we already have this technology in Eclipse, we just need to make it easier to use. To do so, the Eclipse RAP project and the Virgo project recently worked together to create a lightweight server for RAP applications that supports those out-of-the-box deployments. This package, we call it the “Virgo RAP Server”, is an OSGi container based on Equinox, running the Jetty web server, and it’s pre-equipped with all bundles required to run a RAP application – with one exception: workbench applications are not (yet) supported.

A first version is now available on the Virgo build server. This download always contains the latest RAP bundles (RAP 2.3 M1 at the time of writing).

[ More on RAP from our blog: RAP technology overview | Using RAP or Virgo in an industrial setting? Our technology subscriptions secure your investment for years to come. ]

Getting started

Running your application on this server requires only these three steps:

1. Extract the zip file to a folder of your choice

$ unzip virgo-nano-rap-3.7.0.CI-2014-02-21_02-04-03.zip $ cd virgo-nano-rap-3.7.0.CI-2014-02-21_02-04-03

2. Copy your application bundles into the pickup/ directory

$ cp ~/org.example.rap-1.0.0.jar pickup/

3. Start the server using the startup script in bin/

$ bin/startup.sh

That’s it! Now you can access your application at https://localhost:8080/example (replace “/example” with the servlet path of your entrypoint).

Admin console

The Virgo RAP server comes with a nice admin console that can also display package and service wirings between bundles. You can access it at https://localhost:8080/admin. The default credentials are admin:admin.

If you want to get rid of the console for production, simply remove the bundle org.eclipse.virgo.management.console from the pickup/ directory.

Settings

Here’s are short list of things you may like to configure:

Change HTTP port

Per default the embedded Jetty is running on port 8080. The port can be configured in configuration/config.ini.

org.osgi.service.http.port=8080

Enable Equinox OSGi console

The OSGi console is deactivated by default. It can be enabled for access via SSH and/or telnet in configuration/osgi.console.properties:

telnet.enabled=true telnet.port=2401 telnet.host=localhost ssh.enabled=true ssh.port=2402 ssh.host=localhost

Logging

The log files can be found in serviceability/logs. Logging is configured in configuration/serviceability.xml, for a description of the syntax and facilities provided by this file, please consult the LOGBack Manual.

Debugging

To enable remote debugging, start the server in debug mode by adding the parameter -debug to the startup script. Optionally you can also add the -suspend flag to suspend the VM on startup until your IDE connects. For example, you can use this method to observe the startup of your already deployed bundles.

Future

If there’s interest in this deployment option, we plan to provide a stable version of the Virgo RAP server together with this year’s Eclipse release “Luna”, in June 2014.

Let us know what you think! Could this be an interesting option for your project?

Ralf Sternberg

Ralf Sternberg

Ralf is a software engineer with a history as Eclipse committer and project lead.

In recent years, he devoted himself to JavaScript technologies and helped pulling off …