Arun Gupta, Miles to go ...

Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems.
« Previous page | Main | Next page »

http://blogs.sun.com/arungupta/date/20090505 Tuesday May 05, 2009

Sea Change Affinity - Why JRuby/GlassFish ?


At Rails Conf 2009, Jay McGaffigan from Sea Change talked about why they choose JRuby/GlassFish for their product Affinity. Here are some of the reasons he quoted:

  • Performance characterisitics (of GlassFish) have been excellent
  • Picked GlassFish based upon the recommendations from the people in industry
  • Dramatically more throughput on our GlassFish installation, 400 requests/sec instead of 100 requests/sec comapred to Tomcat
Watch the interview recorded earlier today:


Read other simiar stories at glassfish+rubyonrails+stories.

Technorati: jruby rubyonrails glassfish stories

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090504 Monday May 04, 2009

Rails Conf 2009 - Day 1 Trip Report


Rails Conf 2009 started this morning. The first day consists of morning and afternoon tutorials.

I attended Nick Sieger's JRuby on Rails tutorial, the slides are available. A survey in the room showed:

  • 95% comfortable with Ruby/Rails
  • 80% have used JRuby
  • 10% use JRuby actively
Here are some of the key points highlighted in the tutorial:

Why JRuby ?
  • JRuby is "Less Bitter Java", after all Java is a great platform.
  • Concurrency (Native threading)
  • Reliability (well-behaved because of Hotspot compiler, no process monitoring, etc)
  • Encapsulation (take a Rails application, bundle it as a single deployable artifact that is fully contained)
  • Choice (Any Java application server, huge breadth of Java libraries, and can write thin Ruby wrappers around Java libraries)
Download JDK 5 minimum, JDK 6 preferred, MySQL 5.x, JRuby 1.2 (1.3.0 RC1 OK too), GlassFish v2.1 b60e

Common options
  • --server: Run with server VM, better performance
  • --headless: No UI
  • --properties: Show tweaks for compiler, JIT compiling,  thread pooling etc
  • -J<java-opt>: Pass any Java properties
  • -J-Xmx1G: Increase memory to 1G
Drawbacks: No fork(), No native extensions (for example ParseTree, EventMachine, RMagic cannot be used), No tty for subprocesses, Startup time slow for short scripts

Advantages: Improved versions of some Ruby APIs (tempfile, mutex, thread, timeout), 1.8 and 1.9 in a single install (jruby --1.9), Wrap Java libraries and APIs in Ruby

The slides have much more details in terms of deployment options (WAR-based, GlassFish Gem), and many other interesting details Scroll to slide #68 to understand all the guts of kenai.com - a real life application running using JRuby, Rails, and GlassFish.

The afternoon tutorial for me was A Hat Full of Tricks with Sinatra. The tutorial was completely code driven with no slides, just love that format!

The tutorial started with a brief introduction to Rack. A basic Rack application can be "config.ru" or "app.rb", lets start with "config.ru" Hello World:

run lambda { |env|
  [
    200,
    {
    'Content-Length' => '2',
    'Content-Type' => 'text/html',
    },
    ["hi"]
  ]
}

Run it as ...

~/samples/railsconf/sinatra/basic-rack >~/tools/jruby/bin/jruby -S rackup
[2009-05-04 13:40:18] INFO  WEBrick 1.3.1
[2009-05-04 13:40:18] INFO  ruby 1.8.6 (2009-03-16) [java]
[2009-05-04 13:40:18] INFO  WEBrick::HTTPServer#start: pid=90964 port=9292
127.0.0.1 - - [04/May/2009 13:40:27] "GET / HTTP/1.1" 200 2 0.0160
127.0.0.1 - - [04/May/2009 13:40:27] "GET /favicon.ico HTTP/1.1" 200 2 0.0060
127.0.0.1 - - [04/May/2009 13:40:30] "GET /favicon.ico HTTP/1.1" 200 2 0.0100

"config.ru" is the default Rackup script, otherwise need to specify the name. And now "app.rb" ..

App = lambda { |env|
  [
    200,
    {
    'Content-Length' => '2',
    'Content-Type' => 'text/html',
    },
    ["hi"]
  ]
}

And run it as ...

~/samples/railsconf/sinatra/basic-rack >~/tools/jruby/bin/jruby -S rackup app.rb
[2009-05-04 13:43:57] INFO  WEBrick 1.3.1
[2009-05-04 13:43:57] INFO  ruby 1.8.6 (2009-03-16) [java]
[2009-05-04 13:43:57] INFO  WEBrick::HTTPServer#start: pid=90990 port=9292
127.0.0.1 - - [04/May/2009 13:44:09] "GET / HTTP/1.1" 200 2 0.0110

In both cases, the application is accessible at "http://localhost:9292".

Change the basic "config.ru" to convert into a class as ...

class BasicRack
     def call(env)
      body = "Hello from a class"
      [
        200,
        {
        'Content-Length' => body.size.to_s,
        'Content-Type' => 'text/html',
        },
        [body]
      ]
    end
end

run BasicRack.new

and run the same way as earlier.

Change body to "env.inspect" to see an output as:



Sinatra allows reloading of application but that "feature" will be removed soon. Instead install shotgun (which does not work with JRuby yet!). Anyway, install the gem:

~/samples/railsconf/sinatra/basic-rack >~/tools/jruby/bin/jruby -S gem install shotgun
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed configuration-0.0.5
Successfully installed launchy-0.3.3
Successfully installed shotgun-0.2
3 gems installed
Installing ri documentation for launchy-0.3.3...
Installing RDoc documentation for launchy-0.3.3...

And run as:

~/samples/railsconf/sinatra/basic-rack >~/tools/jruby/bin/jruby -J-Djruby.fork.enabled=true -S shotgun
[2009-05-04 13:55:46] INFO  WEBrick 1.3.1
[2009-05-04 13:55:46] INFO  ruby 1.8.6 (2009-03-16) [java]
== Shotgun starting Rack::Handler::WEBrick on localhost:9393
[2009-05-04 13:55:46] INFO  WEBrick::HTTPServer#start: pid=91089 port=9393

Process separate bodies depending upon the info:

class BasicRack
     def call(env)
      body = if env["PATH_INFO"] == "/foo"
        "in foo"
      else
       "in other"
      end
      [
        200,
        {
        'Content-Length' => body.size.to_s,
        'Content-Type' => 'text/html',
        },
        [body]
      ]
    end
end

run BasicRack.new

Accessing "http://localhost:9292/foo" shows "in foo" and accessing "http://localhost:9393" shows "in other".

Target application is the last application specified by "run".

Rack supports middleware which are like filters, they can applied before/after a message is processed.

Rack will initialize middleware at load, so hold on to that application as shown:

class BasicRackApp
     def call(env)
      body = "hello from app"
      [
        200,
        {
        'Content-Length' => body.size.to_s,
        'Content-Type' => 'text/html',
        },
        [body]
      ]
    end
end

class MyMiddleware
    def initialize(app)
        @app = app
    end
   
    def call(env)
        @app.call(env)
    end
end

use MyMiddleware

run BasicRackApp.new

@app.call calls the next middleware in the chain.

Rack comes with couple of standard middleware, e.g.:

use Rack::CommonLogger

Example of an after filter:

    def call(env)
        status, headers, body = @app.call(env)
        body.map! { |part| part.upcase}
        [status, headers, body]
    end

Lots of other filters available.

With a basic Rack understanding, lets build a Sinatra app:

require 'sinatra'

is the simplest Sinatra application. Save it in a file "basic-sinatra.rb" and run it as:

~/samples/railsconf/sinatra/basic-sinatra >~/tools/jruby/bin/jruby -rubygems basic-sinatra.rb
== Sinatra/0.9.1.1 has taken the stage on 4567 for development with backup from WEBrick
[2009-05-04 14:40:14] INFO  WEBrick 1.3.1
[2009-05-04 14:40:14] INFO  ruby 1.8.6 (2009-03-16) [java]
[2009-05-04 14:40:14] INFO  WEBrick::HTTPServer#start: pid=91396 port=4567

The application is now available at "http://localhost:4567". BTW, this app can easily be run using GlassFish Gem as explained  in TOTD #79. Add a simple GET method and "not_found" handler as:

require 'rubygems'
require 'sinatra'

not_found do
  'hi from other'
end

get '/foo' do
    'hi from foo'
end

Every time a request comes in, it builds a request context, instance evals lambda and finds the one that hits.

Sinatra takes care of status and headers, the application needs to process the body.

Another one ...

require 'rubygems'
require 'sinatra'

get '/env' do
    env.inspect
end

And it shows Rack environment hash at 'http://localhost:4567".

Another one ...

require 'rubygems'
require 'sinatra'

get '/' do
end

post '/' do
end 

put '/' do
end

delete '/' do
end

This adds 4 HTTP methods with different routes.

No explicit render method, e.g.

require 'rubygems'
require 'sinatra'

get '/' do
  content_type "application/json"
  { "foo" => "goo" }.to_json
end

No ".rhtml.erb" or ".json.erb", instead it's just ".erb". Add "views/index.erb" as:

<html>
  <body>
  Hello form Sinatra + ERB
  </body>
  </html>

And change GET method to:

require 'rubygems'
require 'sinatra'

get '/' do
  erb :index
end

And the application now uses ERB templating.

Using HAML templates is simple, change to:

require 'rubygems'
require 'sinatra'
require 'haml'

get '/' do
  haml :index
end

And add "views/index.haml" as:

%html
  %body
    %h1 Hello from HAML

And now the application is using HAML templates.

__END__ is the end of Ruby, can be anything after that and it'll not barf. Sinatra uses it for in file templates:

require 'rubygems'
require 'sinatra'
require 'haml'

get '/' do
  erb :index
end

use_in_file_templates!

__END__

@@ index

<html>
  <body>
  Hello form Sinatra + ERB in file
  </body>
  </html>

Start with in-file templates, and then move out to separate directory ("views") once grows big. But no syntax highlighting etc.

Add your custom template as:

require 'rubygems'
require 'sinatra'
require 'haml'

get '/' do
  erb :index
end

get '/foo' do
  erb :foo
end

use_in_file_templates!

__END__

@@ index

<html>
  <body>
  Hello form Sinatra + ERB in file
  </body>
  </html>
 
@@ foo
<h1>FOO!</h1>

With this file "http://localhost:4567/" uses ERB template, and "http://localhost:4567/foo" uses "foo" template.

Sinatra defines on Main. The before filters work before every single request, executed in the same context as lambda. Can be used if every request needs to do some setup.

Helpers can be defined as:

require 'rubygems'
require 'sinatra'
require 'haml'

helpers do
 
end

without defining on Main. Or ...

require 'rubygems'
require 'sinatra'
require 'haml'

module helpers
    def self.dosomething(arg)
    end
end

get '/' do
    Helpers.dosomething
end

Don't define something on Main, it's a bad practice.

Extension is a nice package that can be shared for other Sinatra developers to use, like Rails plugins but does not have boilerplate, much easier to do.

Rest of tutorial was quite fast paced so the code samples could not be captured. But there is boatload of information available at sinatrarb.com.

Check out the pictures from Day 1:


The evening concluded with dinner at Burger Bar at Mandalay Bay along with Project Kenai team.

And check the evolving album at:



On to GlassFish talk tomorrow, and running with @railsConfRunner in the morning before that :)

Technorati: conf railsconf lasvegas jruby rubyonrails sinatra glassfish

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

TOTD #81: How to configure "database.yml" to be used with both JRuby and MRI ?


In JRuby-on-Rails tutorial at Rails Conf 2009, Nick Sieger shared a nice little tip on how to configure "database.yml" to be usable with both JRuby and MRI:

<% jdbc = defined?(JRUBY_VERSION) ? 'jdbc' : '' %>
development:
  adapter: <%= jdbc %>mysql
  encoding: utf8
  reconnect: false
  database: myapp_development
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock
# ...

"JRUBY_VERSION" is defined only if your using JRuby and so the right database adapter is picked up accordingly.

The complete slides for the tutorial are available here. Learn about other related talks here.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. An archive of all the tips is available here.

Technorati: conf railsconf lasvegas tutorial jruby ruby rubyonrails

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090501 Friday May 01, 2009

JRuby, Rails, and GlassFish Bootcamp - San Francisco, May 19/20, 2009

Would you like to power up your Rails applications using JRuby and GlassFish ? And learn that from the engineers who develop the technology.

If yes, then we have organized a bootcamp for you!

Day 1 (FREE) of this bootcamp provides an introduction to JRuby and GlassFish and how they serve as an excellent development and deployment environment for Rails applications. Starting with clean slate on your laptop, you'll be able to setup JRuby, Rails, GlassFish and learn about different options available for running your applications.

Day 2 (need $$$) takes a deep dive on each topic and convert you into a power user instantaneously. The topics range from Virtual Machine tuning for JRuby and GlassFish, Warbler tricks, Java EE integration, Deployment strategies, Monitoring applications to Running other Rack-based frameworks. Lunch and beverages will be served on Day 2.

On both days, you get an opportunity to practice everything on your laptop by following the experts along.

Complete details on venue, time, agenda, etc are available at railscamp.eventbrite.com.

Register now before the seats fill out. And get ready to be drenched!

Technorati: conf jruby rubyonrails glassfish netbeans bootcamp sanfrancisco

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090430 Thursday April 30, 2009

TOTD #81: How to use nginx to load balance a cluster of GlassFish Gem ?

nginx (pronounced as "engine-ex") is an open-source and high-performance HTTP server. It provides the common features such as reverse proxying with caching, load balancing, modular architecture using filters (gzipping, chunked responses, etc), virtual servers, flexible configuration and much more.

nginx is known for it's high performance and low resource consumption. It's a fairly popular front-end HTTP server in the Rails community along with Apache, Lighttpd, and others. This TOTD (Tip Of The Day) will show how to install/configure nginx for load-balancing/front-ending a cluster of Rails application running on GlassFish Gem.
  1. Download, build, and install nginx using the simple script (borrowed from dzone):

    ~/tools > curl -L -O http://sysoev.ru/nginx/nginx-0.6.36.tar.gz
    ~/tools > tar -xzf nginx-0.6.36.tar.gz
    ~/tools > curl -L -O http://downloads.sourceforge.net/pcre/pcre-7.7.tar.gz
    ~/tools > tar -xzf pcre-7.7.tar.gz
    ~/tools/nginx-0.6.36 > ./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin --with-debug --with-http_ssl_module --with-pcre=../pcre-7.7
    ~/tools/nginx-0.6.36 > make
    ~/tools/nginx-0.6.36 > sudo make install
    ~/tools/nginx-0.6.36 > which nginx
    /usr/sbin/nginx

    OK, nginx is now roaring and can be verified by visiting "http://localhost" as shown below:


  2. Create a simple Rails scaffold as:

    ~/samples/jruby >~/tools/jruby/bin/jruby -S rails runner
    ~/samples/jruby/runner >~/tools/jruby/bin/jruby script/generate scaffold runlog miles:float minutes:integer
    ~/samples/jruby/runner >sed s/'adapter: sqlite3'/'adapter: jdbcsqlite3'/ <config/database.yml >config/database.yml.new
    ~/samples/jruby/runner >mv config/database.yml.new config/database.yml
    ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S rake db:migrate
  3. Run this application using GlassFish Gem on 3 separate ports as:

    ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S glassfish
    Starting GlassFish server at: 192.168.1.145:3000 in development environment...
    Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log.
    Press Ctrl+C to stop.

    The default port is 3000. Start the seond one by explicitly specifying the port using "-p" option ..

    ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S glassfish -p 3001
    Starting GlassFish server at: 192.168.1.145:3001 in development environment...
    Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log.
    Press Ctrl+C to stop.

    and the last one on 3002 port ...

    ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S glassfish -p 3002
    Starting GlassFish server at: 192.168.1.145:3002 in development environment...
    Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log.
    Press Ctrl+C to stop.

    On Solaris and Linux, you can run GlassFish as a daemon as well.
  4. Nginx currently uses a simple round-robin algorithm. Other load balancers such as nginx-upstream-fair (fair proxy) and nginx-ey-balancer (maximum connections) are also available. The built-in algorithm will be used for this blog. Edit "/usr/local/nginx/conf/nginx.conf" to specify an upstream module which provides load balancing:
    1. Create a cluster definition by adding an upstream module (configuration details) right before the "server" module:

      upstream glassfish {
              server 127.0.0.1:3000;
              server 127.0.0.1:3001;
              server 127.0.0.1:3002;
          }

      The cluster specifies a bunch of GlassFish Gem instances running at the backend. Each server can be weighted differently as explained here. The port numbers must exactly match as those specified at the start up. The modified "nginx.conf" looks like:



      The changes are highlighted on lines #35 through #39.
    2. Configure load balancing by specifying this cluster using "proxy_pass" directive as shown below:

      proxy_pass http://glassfish;

      in the "location" module. The updated "nginx.conf" looks like:



      The change is highlighted on line #52.
  5. Restart nginx by using the following commands:

    sudo kill -15 `cat /usr/local/nginx/logs/nginx.pid`
    sudo nginx
Now "http://localhost" shows the default Rails page as shown below:



"http://localhost/runlogs" now serves the page from the deployed Rails application.

Now lets configure logging so that the upstream server IP address and port are printed in the log files. In "nginx.conf", uncomment "log_format" directive and add "$upstream_addr" variable as shown:

    log_format  main  '$remote_addr - [$upstream_addr] $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

Also change the log format to "main" by uncommenting "access_log logs/access.log main;" line as shown above (default format is "combined"). Accessing "http://localhost/runlogs" shows the following lines in "logs/access.log":

127.0.0.1 - [127.0.0.1:3000] - [29/Apr/2009:15:27:57 -0700] GET /runlogs/ HTTP/1.1 "200" 3689 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-"
127.0.0.1 - [127.0.0.1:3001] - [29/Apr/2009:15:27:57 -0700] GET /favicon.ico HTTP/1.1 "200" 0 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-"
127.0.0.1 - [127.0.0.1:3002] - [29/Apr/2009:15:27:57 -0700] GET /stylesheets/scaffold.css?1240977992 HTTP/1.1 "200" 889 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-"

The browser makes multiple requests (3 in this case) to load resources on a page and they are nicely load-balanced on the cluster. If an instance running on port 3002 is killed, then the access log show the entries like:

127.0.0.1 - [127.0.0.1:3000] - [29/Apr/2009:15:28:53 -0700] GET /runlogs/ HTTP/1.1 "200" 3689 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-"
127.0.0.1 - [127.0.0.1:3002, 127.0.0.1:3000] - [29/Apr/2009:15:28:53 -0700] GET /favicon.ico HTTP/1.1 "200" 0 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-"
127.0.0.1 - [127.0.0.1:3001] - [29/Apr/2009:15:28:53 -0700] GET /stylesheets/scaffold.css?1240977992 HTTP/1.1 "200" 889 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-"

The second log line shows that server running on port 3002 did not respond and so it automatically fall back to 3000, this is nice!

But this is inefficient because a back-end trip is made even for serving a static file ("/favicon.ico" and "/stylesheets/scaffold.css?1240977992"). This can be easily solved by enabling Rails page caching as described here and here.

More options about logging are described in NginxHttpLogModule and upstream module variables are defined in NginxHttpUpstreamModule.

Here are some nginx resources:
Are you using nginx to front-end your GlassFish cluster ?

Apache + JRuby + Rails + GlassFish = Easy Deployment! shows similar steps if you want to front-end your Rails application running using JRuby/GlassFish with Apache.

Hear all about it in Develop with Pleasure, Deploy with Fun: GlassFish and NetBeans for a Better Rails Experience session at Rails Conf next week.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: rubyonrails glassfish v3 gem jruby nginx loadbalancing clustering

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090427 Monday April 27, 2009

GlassFish, NetBeans, and Project Kenai at Rails Conf 2009


Did you know that ...

  • GlassFish Gem is already used in production
  • GlassFish Gem can be used to run Rails, Merb, Sinatra, and any other Rack-based framework
  • Capistrano recipes are available for starting/stopping/bouncing the server
  • With GlassFish, standard Java monitoring techniques like JMX can be used for monitoring Rails apps
  • NetBeans provide a complete development environment for Rails applications

There are many other similar nuggets that I'll be covering in my Rails Conf 2009 session. Details are given below:

Develop with pleasure, Deploy with Fun: GlassFish and NetBeans for a better Rails experience
Tuesday, May 5th, 2009, 1:50pm
Pavilion 1

Register Today and avail a 15% discount using the code: RC09FOS.

I plan to attend these sessions, lets see how many I can make :-) And of course, you'll see me in the Exhibit Hall.

And you'll get to meet Project Kenai team, they form the foundation for Sun's connected developer experience. Read about their participation here and meet them to learn about NetBeans and Kenai integration.

And if you are interested in running with fellow attendees, follow @railsConfRunner.

And it's Vegas baby!

JRuby and GlassFish is already used in production. Do you have a success story to share ? I'll be happy to promote at RailsConf.

Technorati: conf glassfish netbeans rubyonrails kenai railsconf lasvegas jruby

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090422 Wednesday April 22, 2009

LOTD #21: Production Deployment Tips for running Rails on GlassFish v2 using Windows


SeaChange Affinity uses Rails and GlassFish as their deployment platform. One of their core developers posted tips based upon their experience so far and they are available at:

Rails on GlassFish v2 using Windows

Here are some of the quotes:

Glassfish can really handle a heavy load

and

handling 400 simultaneous users under a supremely heavy load, the memory was holding great

All previous links in this series are archived at LOTD.

Technorati: lotd glassfish jruby rubyonrails windows

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090402 Thursday April 02, 2009

Silicon Valley Rails Meetup, Mar 2009 - Slides & Pics


I presented at Silicon Valley Rails Meetup yesterday. The official attendance says 79 and the kitchen area (for the presentation) was indeed packed!

The demo gods were hovering very much around and required me to reboot the machine - live during the presentation. Have you ever rebooted Mac because of a slow performance, smack in the middle of a demo ? ;-)

Here is a quote from the meetup:

The big win with glassfish is that it gives you the same environment in deployment and development.

The slides are available here. And some pointers to get more information:




And another one ...



Thanks to Michael and Jerry for being the wonderful hosts!

Drop a comment on this blog if you are using GlassFish for your Rails/Merb/Sinatra/... deployments.

Technorati: conf glassfish rubyonrails jruby netbeans meetup

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090331 Tuesday March 31, 2009

ISV & OEMs Webinar Replay: GlassFish- and MySQL-Backed Applications with Netbeans and JRuby-on-Rails

I presented a webinar for ISV and OEMs on "Developing GlassFish- and MySQL-Backed Applications with NetBeans and JRuby-on-Rails" last week.



The slides and a complete recording of the webinar are now available here.

Technorati: webinar glassfish mysql netbeans jruby rubyonrails

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090330 Monday March 30, 2009

GlassFish at Silicon Valley Rails Meetup

Want to know how NetBeans and GlassFish provide a better Rails experience ?

I'll be speaking at Silicon Valley Rails Meetup on Mar 31st (tomorrow), 7pm, more details here. It will also be a brief preview of my upcoming Rails Conf talk.

Click on the map below for location:



This is "LinkedIn Headquarters" and we'll see you at 2nd Floor Kitchen and Open Area.

See you there!

Technorati: conf rubyonrails glassfish netbeans meetup

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090323 Monday March 23, 2009

Developing GlassFish- and MySQL-Backed Applications with Netbeans and JRuby-on-Rails - Free Webinar on Mar 26


This is a re-run of an earlier webinar.

Would you like to know how JRuby,NetBeans, GlassFish, and MySQL can power your Rails applications ?



This informative technical webinar explains the fundamentals of JRuby and how the NetBeans IDE makes developing/debugging/deploying Rails applications on GlassFish quick, fun and cost-effective.

The webinar starts 10am PT on Mar 31st, 2009 and can be accessed from a browser.

Register here.

Technorati: jruby rubyonrails glassfish netbeans mysql webinar

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090320 Friday March 20, 2009

TOTD # 76: JRuby 1.2, Rails 2.3, GlassFish Gem 0.9.3, ActiveRecord JDBC Adapter 0.9.1 - can they work together ?


Oh, what a week for the JRuby, Rails, and GlassFish enthusiasts!

JRuby 1.2, Rails 2.3GlassFish Gem 0.9.3, and ActiveRecord JDBC Adapater 0.9.1 - all released earlier this week. This is an opportune moment to run the integration tests to ensure the latest JRuby and GlassFish versions work nicely with each other.

First, lets see whats there to get exicted in each release.

JRuby 1.2 introduces a new versioning scheme by jumping from 1.1.6 -> 1.2. JRUBY-3649 is an important fix for the Windows users. Improved Ruby 1.9 support, 3-6x faster parsing, and preliminary android support are some other highlights. 1052 revisions and 256 bugfixes since 1.1.6 (89 days ago) means close to 12 revisions / day and 3 bugfixes/day!

Rails 2.3 has a bunch of highlights ranging from Rack integration, nested forms, attributes, and transactions, reconnecting lost MySQL connections, Application controller renamed (make sure to "rake rails:update:action_controller" to update from an older version), faster boot time in dev mode using lazy loading, and many others. The Release Notes provide all the detailed information.

The GlassFish Gem with features like running as daemon,  rake-style configuration of JVM options, ability to "sudo install" gem and run as normal user and multi-level logging are all gearing towards adding more production-quality features. My favorite here is running as daemon since that brings the Gem one step closer to the Rails community.

Lets get back to running our tests #1, #2, #3, #4, and #5 for these released versions.

First, lets unzip JRuby 1.2 and install Rails 2.3, GlassFish Gem 0.9.3, and other gems as:

~/tools/jruby-1.2.0 >./bin/jruby -S gem install rails glassfish activerecord-jdbcmysql-adapter
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
Successfully installed rack-0.9.1
Successfully installed glassfish-0.9.3-universal-java
Successfully installed activerecord-jdbc-adapter-0.9.1
Successfully installed jdbc-mysql-5.0.4
Successfully installed activerecord-jdbcmysql-adapter-0.9.1
11 gems installed
Installing ri documentation for activesupport-2.3.2...
Installing ri documentation for activerecord-2.3.2...
Installing ri documentation for actionpack-2.3.2...
Installing ri documentation for actionmailer-2.3.2...
Installing ri documentation for activeresource-2.3.2...
Installing ri documentation for rack-0.9.1...
Installing ri documentation for glassfish-0.9.3-universal-java...
Installing ri documentation for activerecord-jdbc-adapter-0.9.1...
Installing ri documentation for jdbc-mysql-5.0.4...
Installing ri documentation for activerecord-jdbcmysql-adapter-0.9.1...
Installing RDoc documentation for activesupport-2.3.2...
Installing RDoc documentation for activerecord-2.3.2...
Installing RDoc documentation for actionpack-2.3.2...
Installing RDoc documentation for actionmailer-2.3.2...
Installing RDoc documentation for activeresource-2.3.2...
Installing RDoc documentation for rack-0.9.1...
Installing RDoc documentation for glassfish-0.9.3-universal-java...
Installing RDoc documentation for activerecord-jdbc-adapter-0.9.1...
Installing RDoc documentation for jdbc-mysql-5.0.4...
Installing RDoc documentation for activerecord-jdbcmysql-adapter-0.9.1...

If you have a previous version of GlassFish gem installed, then update it as:

~/tools/jruby-1.1.6 >./bin/jruby -S gem update glassfish
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Updating installed gems
Updating glassfish
Successfully installed glassfish-0.9.3-universal-java
Gems updated: glassfish

Similarly ActiveRecord gem can be updated as:

~/tools/jruby-1.1.6 >./bin/jruby -S gem update activerecord
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Updating installed gems
Updating activerecord-jdbc-adapter
Successfully installed activerecord-jdbc-adapter-0.9.1
Updating activerecord-jdbcmysql-adapter
Successfully installed activerecord-jdbcmysql-adapter-0.9.1
Updating activerecord-jdbcsqlite3-adapter
Successfully installed jdbc-sqlite3-3.6.3.054
Successfully installed activerecord-jdbcsqlite3-adapter-0.9.1
Updating merb_activerecord
Successfully installed merb_activerecord-1.0.0.1
Gems updated: activerecord-jdbc-adapter, activerecord-jdbcmysql-adapter, jdbc-sqlite3, activerecord-jdbcsqlite3-adapter, merb_activerecord

Running test #1 encounters JRUBY-3502, basically "db:create" is not working with JRuby 1.2.0, Rails 2.3.2 and MySQL ActiveRecord JDBC Adapter. However "db:create" works if JRuby 1.2.0 and Rails 2.2.2 are used. Alternatively SQLite3 ActiveRecord JDBC Adapter may be used. So first lets install SQLite3 JDBC adapter as:

~/tools/jruby-1.2.0 >./bin/jruby -S gem install activerecord-jdbcsqlite3-adapter
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed jdbc-sqlite3-3.6.3.054
Successfully installed activerecord-jdbcsqlite3-adapter-0.9.1
2 gems installed
Installing ri documentation for jdbc-sqlite3-3.6.3.054...
Installing ri documentation for activerecord-jdbcsqlite3-adapter-0.9.1...
Installing RDoc documentation for jdbc-sqlite3-3.6.3.054...
Installing RDoc documentation for activerecord-jdbcsqlite3-adapter-0.9.1...

Now lets recreate our application without specifying "-d mysql" switch as:

~/tools/jruby-1.2.0/samples/rails >../../bin/jruby -S rails runner
      create 
      create  app/controllers
      create  app/helpers
. . .
      create  log/production.log
      create  log/development.log
      create  log/test.log

In the generated "config/database.yml", change the database adapter from:

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

to

development:
  adapter: jdbcsqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

The changes are highlighted in bold. Run the remainder of test #1.

The supported Rails version on GlassFish v3 Prelude is Rails 2.1 so we'll stick with running a Rails 2.1 (instead of Rails 2.3.2) simple scaffold application but will use the latest JRuby 1.2.0. Running a Rails 2.3.2 on GlassFish v3 Prelude will encounter issue #7384. Please add your comments to the bug report if you are running GlassFish v3 Prelude in production and would like this bug to be fixed!

Rails 2.3.2 require workaround for a WAR-based deployment of a Rails application as expained here. This workaround is required only if you are using JRuby-Rack 0.9.1 or lower. A newer version of JRuby-Rack may solve these problems making these steps optional. The steps are anyway outlined below for convenience:
  1. Uncomment the following line from "config/initializers/session_initializers.rb":

    ActionController::Base.session_store = :active_record_store
  2. Do "jruby -S warble config" to generate the template "config/warble.rb", edit it and add the following line:

    config.webxml.jruby.session_store = 'db'
  3. In "config/environment.rb", add the following code:

     if defined?(JRUBY_VERSION)
     # hack to fix jruby-rack's incompatibility with rails edge
     module ActionController
       module Session
         class JavaServletStore
           def initialize(app, options={}); end
           def call(env); end
         end
       end
     end
    end 

    just above the line "Rails::Initializer.run do |config|".
Always refer to JRuby/Rails 2.3.2 wiki for the latest information on these steps.

The deployment goes fine after making the changes but bringing up the scaffold page in the browser shows the following error message:


So commented the "jndi" and "driver" entry from "config/database.yml" such that the bundled MySQL JDBC Adapter is used instead. And then the test passes.

Here is a status report after running all the tests:

Test # Description Status
#1 Simple Scaffold using GlassFish Gem PASS (with workaround in JRUBY-3502)
#2 Simple Scaffold using GlassFish v3 Prelude PASS
#3 Simple Scaffold using GlassFish v3 FAIL (used workaround mentioned in JRUBY-3502,  issues #7266, #7270, #7271 still need to be fixed). PASS if the Application and Controller name are different.
#4 Simple Scaffold as WAR-based application on GlassFish v2.1 FAIL (issue #7385), PASS (with workaround in issue JRUBY-3515)
#5 Redmine using GlassFish Gem PASS

It's certainly exciting to know that @grantmichaels is already using the latest version of GlassFish Gem and Rails in production :)

JRuby/GlassFish Wiki provide a list of other known JRuby/Rails/GlassFish deployments in production. Leave a comment on this blog if you are using it as well and we'll be happy to add your name!

The complete set of tests are available using the tags rubyonrails+glassfish+integrationtest. So to answer the title of this blog - YES, JRuby 1.2.0, Rails 2.3.2, GlassFish Gem 0.9.3, ActiveRecord JDBC Adapater 0.9.1 all work together with the restrictions stated above. GlassFish v3 is a moving target and the bugs will be fixed soon. JRUBY-3515 is what delayed this entry otherwise would've posted it much earlier ;-)

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: totd rubyonrails glassfish v3 gem jruby sampleapp activerrecord redmine integrationtest

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090316 Monday March 16, 2009

TOTD # 74: JRuby and GlassFish Integration Test #5: JRuby 1.2.0 RC2 + Rails 2.x.x + GlassFish + Redmine


TOTD #70, #71, #72, #73 shows four integration tests that can ensure that the latest JRuby and GlassFish versions work nicely with each other.

#70 showed how to create a trivial Rails application and run it using GlassFish Gem#71 showed how the same application can be deployed on GlassFish v3 Prelude#72 showed how to deploy the same application on GlassFish v3. #73 showed how to deploy a Rails application as WAR file and use the JDBC connection pooling framework available in GlassFish.

The next set of tests ensure that some commonly used open source Rails applications can be easily run using this setup. The first one is Redmine - 0.8 is the stable release now. Redmine was first tried on GlassFish a few months ago. The steps have simplified since then :)

Lets begin integration test #5.

  1. Download Redmine 0.8 ...

    /samples/jruby/redmine >svn co http://redmine.rubyforge.org/svn/branches/0.8-stable redmine-0.8
    A    redmine-0.8/test
    A    redmine-0.8/test/unit
    A    redmine-0.8/test/unit/document_test.rb
    A    redmine-0.8/test/unit/token_test.rb
    . . .
    A    redmine-0.8/public/stylesheets/scm.css
    A    redmine-0.8/public/stylesheets/application.css
    A    redmine-0.8/public/favicon.ico
     U   redmine-0.8
    Checked out revision 2580.
  2. Copy "config/database.yml.example" to "config/database.yml" and then generate/migrate the database:

    ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S rake db:create
    (in /Users/arungupta/samples/jruby/redmine/redmine-0.8)
    ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S rake db:migrate
    (in /Users/arungupta/samples/jruby/redmine/redmine-0.8)
    == 1 Setup: migrating =========================================================
    -- create_table("attachments", {:force=>true})
       -> 0.0880s
    -- create_table("auth_sources", {:force=>true})
       -> 0.1430s
    . . .
    == 100 AddChangesetsUserId: migrating =========================================
    -- add_column(:changesets, :user_id, :integer, {:default=>nil})
       -> 0.0980s
    == 100 AddChangesetsUserId: migrated (0.0990s) ================================

    == 101 PopulateChangesetsUserId: migrating ====================================
    == 101 PopulateChangesetsUserId: migrated (0.0030s) ===========================

  3. Redmine is a Rails 2.1.x application so install Rails 2.1.x using JRuby 1.2 and run the application as:

    ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S glassfish
    Mar 13, 2009 11:14:59 AM com.sun.enterprise.glassfish.bootstrap.ASMainStatic findDerbyClient
    INFO: Cannot find javadb client jar file, jdbc driver not available
    Mar 13, 2009 11:14:59 AM APIClassLoaderService createAPIClassLoader
    INFO: APIClassLoader = java.net.URLClassLoader@59fb8de1
    . . .
    Mar 13, 2009 11:15:10 AM com.sun.grizzly.pool.DynamicPool$1 run
    INFO: New instance created in 10,175 milliseconds
    Mar 13, 2009 11:15:10 AM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: GlassFish v3  startup time : Static(356ms) startup services(11456ms) total(11812ms)

    Very simple and seamless!
The application is now accessible at "http://locahost:3000". The following screen dumps are captured by traversing through different parts of the application:















The next blog will show the last test in this series. The current set of tests are available using the tags rubyonrails+glassfish+integrationtest.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: totd rubyonrails glassfish v3 gem jruby sampleapp redmine integrationtest

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090313 Friday March 13, 2009

JRuby, Rails, and GlassFish - "Easiest Rails stack in the world"!!!


@grantmichaels is one happy JRuby/Rails/GlassFish user. Here are some of his comments ...

http://twitpic.com/22b5o - the easiest rails stack in the world, jruby 1.2rc, rails 2.3rc, glassfish v3 - (tweeted here)

and

@arungupta had wiped/restated one of my linodes to refront w/ nginx instead of passenger and it took only 1-2 mins to setup jruby/glassfish -  (tweeted here)

and

@arungupta can only have praise for how simple it is to get a working, deployable jruby/rack/glassfish stack for sinatra/rails/ramaze etc - (tweeted here)

and

too easy to run jruby/rack/glassfish behind nginx - going to bed a happy camper tonight ... (tweeted here)

We are very happy to know that users find JRuby and GlassFish easy-to-use for running their Rails applications!

Want to know who else is using GlassFish and Rails together ? Read here.

Did you know that you even deploy your Merb and Grails applications on GlassFish ? glassfish-scripting.dev.java.net provides all the details.

Technorati: glassfish jruby rubyonrails stories

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090311 Wednesday March 11, 2009

TOTD # 73: JRuby and GlassFish Integration Test #4: JRuby 1.2.0 RC2 + Rails 2.2.x + GlassFish v2 + Warbler


TOTD #70, #71, #72 shows the first three integration tests that I typically run to ensure that the latest JRuby and GlassFish versions work nicely with each other.  #70 showed how to create a trivial Rails application and run it using GlassFish Gem#71 showed how the same application can be deployed on GlassFish v3 Prelude#72 showed how to deploy the same application on GlassFish v3.

The next test in the series is to ensure WAR-based deployment of a Rails application continue to work on GlassFish v2. It also shows that JNDI database connection pooling also work as expected. The latest publicly available build is GlassFish v2.1.

Lets begin integration test #4.

  1. Install Warbler gem ...

    ~/tools/jruby-1.2.0RC2/samples/rails/runner >../../../bin/jruby -S gem install warbler
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Successfully installed warbler-0.9.12
    1 gem installed
    Installing ri documentation for warbler-0.9.12...
    Installing RDoc documentation for warbler-0.9.12...
  2. Edit "config/database.yml" and change the production database adapater from:

    production:
      adapter: mysql
      encoding: utf8
      database: runner_production
      pool: 5
      username: root
      password:
      socket: /tmp/mysql.sock

    to

    production:
      adapter: jdbcmysql
      encoding: utf8
      database: runner_production
      pool: 5
      username: duke
      password: glassfish
      socket: /tmp/mysql.sock
      jndi: jdbc/runner_production
      driver: com.mysql.jdbc.Driver

    The changes are highlighted in bold.

    Notice "jndi" key/value pair is specified along with "username" and "password". The JNDI reference is created for the GlassFish domain later. The reference is not resolved when this adapter is used with the JRuby CLI and so it falls back to username/password. However this JNDI reference is correctly resolved during runtime when the application is deployed as a WAR file in GlassFish.
  3. Create and migrate the production database as:

    ~/tools/jruby-1.2.0RC1/samples/rails/runner >../../../bin/jruby -S rake db:create RAILS_ENV=production
    (in /Users/arungupta/tools/jruby-1.2.0RC1/samples/rails/runner)
    ~/tools/jruby-1.2.0RC1/samples/rails/runner >../../../bin/jruby -S rake db:migrate RAILS_ENV=production
    (in /Users/arungupta/tools/jruby-1.2.0RC1/samples/rails/runner)
    ==  CreateRunners: migrating ==================================================
    -- create_table(:runners)
       -> 0.1150s
       -> 0 rows
    ==  CreateRunners: migrated (0.1170s) =========================================

    Note, how "RAILS_ENV=production" is specified at the command-line to ensure the production environment.
  4. Copy MySQL Connector/J jar in GLASSFISH_HOME/lib as:

    ~/tools/glassfish/v2.1/glassfish/ >cp ~/tools/mysql-connector-java-5.1.6/mysql-connector-java-5.1.6-bin.jar ./lib

    This is required for connection to the MySQL database.
  5. Fire up GlassFish v2.1 as:

    ~/tools/glassfish/v2.1/glassfish/bin >./asadmin start-domain
    Starting Domain domain1, please wait.
    Default Log location is /Users/arungupta/tools/glassfish/v2.1/glassfish/domains/domain1/logs/server.log.
    Redirecting output to /Users/arungupta/tools/glassfish/v2.1/glassfish/domains/domain1/logs/server.log
    Domain domain1 started.
    Domain [domain1] is running [Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)] with its configuration and logs at: [/Users/arungupta/tools/glassfish/v2.1/glassfish/domains].
    Admin Console is available at [http://localhost:4848].
    Use the same port [4848] for "asadmin" commands.
    User web applications are available at these URLs:
    [http://localhost:8080 https://localhost:8181 ].
    Following web-contexts are available:
    [/web1  /__wstx-services runner ].
    Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
    [service:jmx:rmi:///jndi/rmi://Macintosh-187.local:8686/jmxrmi] for domain management purposes.
    Domain listens on at least following ports for connections:
    [8080 8181 4848 3700 3820 3920 8686 ].
    Domain supports application server clusters and other standalone instances.

    The logs are created in "domains/domain1/logs/server.log". Optionally, you can specify "--verbose" on the command-line to dump the log on the console itself.
  6. Create JDBC connection pool as:

    ~/tools/glassfish/v2.1/glassfish/bin >./asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype javax.sql.DataSource --property "User=duke:Password=glassfish:URL=jdbc\:mysql\://localhost/runner_production" jdbc/runner_pool
    Command create-jdbc-connection-pool executed successfully.

  7. Create JDBC resource as:

    ~/tools/glassfish/v2.1/glassfish/bin >./asadmin create-jdbc-resource --connectionpoolid jdbc/runner_pool jdbc/runner_production
    Command create-jdbc-resource executed successfully.
  8. Create Warbler config file as:

    ~/tools/jruby-1.2.0RC2/samples/rails/runner >../../../bin/jruby -S warble config
    cp /Users/arungupta/tools/jruby-1.2.0RC2/lib/ruby/gems/1.8/gems/warbler-0.9.12/generators/warble/templates/warble.rb config/warble.rb
  9. Edit "config/warble.rb" to bundle the required gems by adding the following fragment:

     # Include all gems which are used by the web application
      require "#{RAILS_ROOT}/config/environment"
      BUILD_GEMS = %w(warbler rake rcov)
      for gem in Gem.loaded_specs.values
        next if BUILD_GEMS.include?(gem.name)
        config.gems[gem.name] = gem.version.version
      end

    as specified here. And then explicitly specify the runtime gem dependency by adding the following line:

    config.gems += ["activerecord-jdbc-adapter"]

    right after the previous code fragment. The "activerecord-jdbc-adapter" dependency needs to be explicitly included because this is required only at the runtime and so not resolved correctly by the previous code fragment.
  10. And create the WAR file as:

    ~/tools/jruby-1.2.0RC2/samples/rails/runner >../../../bin/jruby -S warble
    mkdir -p tmp/war/WEB-INF/gems/specifications
    cp /Users/arungupta/tools/jruby-1.2.0RC2/lib/ruby/gems/1.8/specifications/rails-2.2.2.gemspec tmp/war/WEB-INF/gems/specifications/rails-2.2.2.gemspec
    mkdir -p tmp/war/WEB-INF/gems/gems
    . . .
    cp public/javascripts/prototype.js tmp/war/javascripts/prototype.js
    cp public/stylesheets/scaffold.css tmp/war/stylesheets/scaffold.css
    mkdir -p tmp/war/WEB-INF
  11. Deploy the WAR file ...

    ~/tools/jruby-1.2.0RC2/samples/rails/runner >~/tools/glassfish/v2.1/glassfish/bin/asadmin deploy runner.war
    Command deploy executed successfully.

    After adding few entries the page at "http://localhost:8080/runner/runners" looks like:


So we are able to deploy a trivial Rails application as WAR file on GlassFish v2.1 and also leverage the JDBC connection pooling, that passes Test# 4.

Later blogs will show the remainder of tests. The current set of tests are available using the tags rubyonrails+glassfish+integrationtest.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: totd rubyonrails glassfish v2 jruby warbler connectionpooling jdbc jndi integrationtest

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.