Skip to main content

JRuby and Rails on GlassFish v3 Prelude - An Overview

Posted by vivekp on November 6, 2008 at 6:29 PM PST


GlassFish v3 Prelude supports
deployment of Rails applications and also
other dynamic language based frameworks such as Grails, which is based
on groovy language.



The support for dynamic languages based frameworks on GlassFish v3
comes through it's modular and extensible architecture and support for
pluggable Containers. Rails and Grails are just different Container
which are also OSGi bundles that get plugged in to GlassFish v3. Read
on the overview of GlassFish v3 Prelude architecture in href="http://blogs.sun.com/dochez/entry/glassfish_v3_prelude_debuts_today">Jerome's
blog.



The architecture diagram below shows how support for Ruby on Rails
applications
is realized in side GlassFish v3 Prelude



jrubycontainer.png src="http://weblogs.java.net/blog/vivekp/archive/images/jrubycontainer.png"
height="593" width="729">
 


Key features

  • Rails application deployment
    - natural Rails way, no packaging
    • asadmin deploy myRailsApp/
  • Choice to deploy as WAR also
    • JRuby -S install warbler
    • warble
    • asadmin deploy
      myRailsApp.war
  • Needs JRuby runtime to run
    the Rails application
    • Install JRuby runtime and
      ready-to-go set of gems (Rails, JDBC-MySQL adapter, warbler) from
      GlassFish v3 Update Center
      • glassfish-install/bin/updateool
      • alt="jruby-uc-small.png"
        src="http://weblogs.java.net/blog/vivekp/archive/images/jruby-uc-small.png"
        height="456" width="640">

    • The simply deploy your
      Rails application on GlassFish
      • asadmin deploy
        myRailsApp/
    • If you have your own JRuby
      installation with the set of required gems then you need to tell
      GlassFish where it is available. you can chose to do one of the
      following
      • java
        -Djruby.home=/tools/jruby-1.1.5 modules/glassfish.jar
      • Edit domain.xml
        (glassfish-install/glassfish/domains/domain1/config/domain.xml) and add
        • <jvm-options>-Djruby.home=/tools/jruby-1.1.5</jvm-options>
  • Access to GlassFish v3
    JavaEE features
    • JDBC connection pool
      • See href="http://blogs.sun.com/arungupta/entry/totd_44_jdbc_connection_pooling">
        Arun's
        blog 
  • Host your JavaEE, Grails,
    JRuby/Rails applications side by side
  • Easier, scalable deployment
    • Rails is single threaded.
      GlassFish keeps JRuby runtimes in a pool, which can be configured based
      on the available resources to scale better
    • Read href="http://wiki.glassfish.java.net/Wiki.jsp?page=ConfiguringJRubyRuntimePool">here
      on how to configure JRuby runtime pool
  • href="http://download.netbeans.org/netbeans/6.5/rc/">NetBeans
    6.5 RC2 supports development,
    deployment and debugging of Rails applications on GlassFish v3 Prelude

Now, go and get href="https://glassfish.dev.java.net/downloads/v3-prelude.html">GlassFish
v3 Prelude and start developing,
deploying your Rails applications on it:-) You may like to bookmark href="http://wiki.glassfish.java.net/Wiki.jsp?page=JRuby">JRuby
GlassFish wiki  for
details and if you have questions let us know through the href="webtier@glassfish.dev.java.net">mailing list
or report an issue on the href="https://glassfish.dev.java.net/servlets/ProjectIssues">issue
tracker.


Related Topics >>