Run Google App Engine Apps on the OpenShift PaaS - Archived

Want to run Google App Engine (GAE) Applications on OpenShift? You can do it with a JBoss AS extension called CapeDwarf–read more about it on a CapeDwarf home page.

OpenShift integration options

OpenShift’s PaaS (Platform as a Service) “framework” provides several options to integrate different application servers and make them available as a service.

You can build your own customized PaaS from the DIY (do it yourself) cartridge, by creating an application template for a “Quick Start” application which uses another cartridge eg. JBoss AS or you can build your own cartridge.

A Quick Start is a template application, which is pulled from remote git repository, using an existing OpenShift cartridge. CapeDwarf requires JBoss AS with some extra modules. Fortunately, the JBoss AS cartridge already provides a solution for adding extra modules.

Integrating CapeDwarf

CapeDwarf is under intensive development and requires the latest features from JBoss AS, which are unfortunately not present in the current JBoss AS version provided by OpenShift. Thanks to JBoss AS modular structure, we can add new versions of the required modules. Due to many required updates and its dependencies, CapeDwarf on OpenShift will be doing a complete module overlay.

With a complete module overlay comes a problem with the modules number and size, which we don’t want to put in a users git repo as it is provided out of the box in a JBoss AS cartridge.

If we don’t won’t all the modules in the users git repo, we must take some extra steps. We must first find another place to store modules. In this case, tell JBoss AS to use them and a script to pull them from a remote location.

In this respect we’ll make use of OpenShift’s “action hooks,” which are scripts that are executed on events. If you take a look at your application running on OpenShift, you will find hooks in /.openshift/action_hooks/. Looking for place to store modules you can check gear directory structure, CapeDwarf uses ~/app-root/runtime/capedwarf folder to store JBoss AS modules.

Where CapeDwarf kicks in

CapeDwarf integrates in a pre_build hook and uses pre_start_jbossas-7 to pass modules and storage configuration to JBoss AS. By setting JBOSS_MODULEPATH_ADD variable, which is used in JBoss AS start-up script, we can add extra modules folder to modules path. Storage location is defined by adding “jboss.server.data.dir” to JAVA_OPTS.

The “pre_build” hook is responsible for installing CapeDwarf modules. On a first run it pulls in the latest tagged version of modules from Github and copies them to the local (OpenShift) folder. In a pre_build hook there is also an update mechanism that checks for new versions of modules, this way your application checks for CapeDwarf updates on each restart. Checking of updates is done by comparing remote version.ini file with the local one.

Conclusion

As you can see it was quite easy to integrate CapeDwarf into OpenShift using the application template for a Quick Start. This is definitely the fastest way to create/customize your PaaS. It’s a bit problematic that the modules must be downloaded from a remote location, what takes some time to complete. We are moving CapeDwarf is moving to its own cartridge to avoid this. It should be implemented as a subcartridge of existing JBoss AS cartridge so keep an eye out for it.

Try out CapeDwarf and practice creating your own Quick Start. If you have any question stop by and ask us on #openshift or #capedwarf on irc.freenode.net.

What’s Next?

Categories
JBoss
Tags
Comments are closed.