Skip to main content

TOTD #32: Rails Deployment on GlassFish v3 from NetBeans IDE

Posted by arungupta on April 28, 2008 at 6:42 AM PDT



href="http://developers.sun.com/appserver/reference/techart/rails_gf/">Rails
powered by the GlassFish Application Server explains all the
benefits of using GlassFish for developing and deploying your Rails
applications. If you are using href="http://download.netbeans.org/netbeans/6.1/final/">NetBeans
6.1 builds then you can deploy your href="http://rubyonrails.org">Rails application
directly on GlassFish
v3
from within NetBeans
IDE
. No longer you need
to have different development and deployment options.



This blog explains how to install a bleeding-edge GlassFish v3 plugin
and use it to deploy your Rails app natively on GlassFish (no WAR or
anything :). Let's get started! Note, this plugin is bleeding edge and
will soon be released on the Beta Update Center.

  1. Install "GlassFish v3 TP2" plugin in NetBeans 6.1
    1. In NetBeans 6.1 IDE, go to "Tools", "Plugins" and click
      on
      "Settings". The following window is shown:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-dep-plugins.png">
    2. Click on "Add" and specify the URL of href="http://blogs.sun.com/octav/entry/bleeding_edge_plugins">Bleeding
      Edge Update Center values as shown (copy from
      "http://deadlock.netbeans.org/hudson/job/javadoc-nbms/lastSuccessfulBuild/artifact/nbbuild/nbms/updates.xml.gz"):



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-dev-uc.png">



      Click on "OK". The updated "Plugins" window looks like:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-dev-uc-added.png">





      Notice "Available Plugins" has changed from 58 to 140 as many
      more bleeding edge plugins are now available.
    3. Click on "Available Plugins" and search for "GlassFish"
      in the top-right corner text box as shown below:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-gf-search.png">
    4. Select "GlassFish V3 JRuby Integration" and "GlassFish V3
      JavaEE Integration" plugin and click on "Install" as shown below:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-gf-selected.png">



      Follow the instructions to install the plugin. The IDE needs to restart
      for successful plugin installation.
    5. In
      the restarted IDE,  go to "Services" tab, right-click on
      "Servers"
      and select "Add Server...". Select "GlassFish v3 TP2" as shown below:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-tp2-selected.png">
    6. Select "Next >", accept the license agreement and
      click on "Download V3 Now..."



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-tp2-download.png">



      Click on "Download V3 Now...". This downloads the latest GlassFish v3
      TP2 build and installs in "/Users/arungupta/GlassFish_V3_TP2"
      directory. This is only an interim build, final TP2 build will be
      available href="http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3Schedule">soon!
      The following screen is shown once GlassFish v3 is installed:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-gf-tp2-installed.png">



      Click on "Finish". In 58 seconds, you downloaded and installed the
      entire GlassFish v3 app server, cool isn't it!
  2. Create a Rails app and deploy on GlassFish V3
    1. In NetBeans IDE, in the "Projects" tab, right-click and
      select "New Project...". Select "Ruby" in "Categories" and "Ruby on
      Rails Applications" in "Projects" as shown:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-create-new.png">



      Click on "Next".
    2. Now comes the cool part. Enter the application name and
      select the recently installed GlassFish v3 as shown:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-tp2-server.png">



      This is a brand new feature in the "GlassFish v3 TP2" plugin available
      only on "Bleeding Edge" Update Center. It'll soon replace the default
      GlassFish v3 plugin from the Beta Update Center.



      Click on "Finish" to take all other defaults.
    3. On the newly created project, right-click and select
      "Run" as shown:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-select-run.png">
    4. The default browser page "http://localhost:8080/" shows
      up. Change the URL to "http://localhost:8080/HelloRails" and the
      following page shows up:



      src="http://blogs.sun.com/arungupta/resource/netbeans/nb61-v3-rails-browser-default.png">

Now, NetBeans IDE and GlassFish v3 serves your need for a complete
development and deployment platform for Ruby-on-Rails applications.



If any part of the tooling is not working or you have suggestions and
improvement then please file bugs on href="http://www.netbeans.org/issues/enter_bug.cgi?component=serverplugins">IssueZilla
("serverplugins" component) and use "glassfish_v3" subcomponent. If any
part of the runtime is not working, then please file bugs on href="https://glassfish.dev.java.net/issues/enter_bug.cgi?issue_type=DEFECT">Issue
Tracker ("V3" component) and use "jruby" subcomponent.

Please leave suggestions on other TOTD (Tip Of The Day) that
you'd like to see.
A complete archive is available href="http://blogs.sun.com/arungupta/tags/totd">here.

Technorati: totd
glassfish
v3 href="http://technorat.com/tag/netbeans">netbeans href="http://technorat.com/tag/rubyonrails">rubyonrails

Related Topics >>