Saturday, September 1, 2007

JRuby/Rails on Glassfish Actually Works!

So traffic was so bad on Thursday I popped open my Powerbook on the Edens spur (I swear it took me an hour to go 3 miles) and listened to Java Posse 138 which had a lengthy (but quite excellent interview with several Sun developers from Glassfish. Java Posse is an excellent podcast. I wish there was something of comparable quality on Ruby, but no time for that rant.

Besides the performance improvements (indeed the startup time is quite amazing compared to JBOSS, Geronimo, or Sun's appserver) they mentioned running JRuby apps and I ran across this blog entry on running interpreted rails apps within Glassfish v3 and the Grizzly connector.

I had to make few changes to get it working to Linux-ify the tutorial (had to create a symlink within glassfish/lib to point to the jruby directory) but it was relatively straightforward on Debian 4.0, (JRuby 1.0.1 and jdk1.6.0_02)

Here the slight differences:

I set the environment variables in .bashrc


JAVA_HOME=~/jdk6
JRUBY_HOME=~/java/jruby
GLASSFISH_HOME=~/java/glassfish
PATH=$PATH:$JAVA_HOME/bin/:$JRUBY_HOME/bin:$GLASSFISH_HOME/bin


Install rails (added --no-ri)


# jruby -S gem install rails -y --no-ri --no-rdoc



Modify glassfish/config/asenv.conf instead of asenv.bat


JRUBY_HOME="/root/java/jruby"


Make asadmin exectuable (chmod u+x/700)