views:

45

answers:

2

We're looking at some alternatives to our Tomcat based stack for a JRuby on Rails app.

So far I've read about the Trinidad gem, which is actually Tomcat based, and the Glassfish gem. I can't however for either of these find production examples. Both of them it seems allow you to just run the command on command line, which is fine for local dev, but how do people use these solutions in production?

There doesn't seem to be much action on the Glassfish gem these days, though it's highly touted for being small and fast.

Does anyone have another setup that they find to be performant, robust and easy to deploy for a JRuby on Rails app?

A: 

Well, jetty has always worked well for me in the Java world. And a quick google search turns up a jetty-rails gem: http://jetty-rails.rubyforge.org/

raeb
i found that also but it looks rather untouched in the past year or so
brad
A: 

Trinidad gem / Embedded Tomcat

If you dig deeper into the Trinidad gem page on Github there are links to the various Trinidad extension gems. There is a daemonizing gem specifically supplied for use in production here:

http://github.com/calavera/trinidad_daemon

If you execute the install script and answer a handful of simple questions, it generates a tailored init script for your Ubuntu or OS X machine. That's pretty much all you need.

There are also example init scripts in the wiki here:

http://github.com/calavera/trinidad_daemon_extension/wiki/init.d-scripts

Note that for use in the Rails.threadsafe! mode, both min and max JRuby runtimes are set to 1 in your trinidad.yml configuration file.

I have it working on Ubuntu with an Nginx frontend, and it's working very nicely.

So yes, this means that you use the command line to stop and start the application server, but the init script will also be called automatically on system startup. The wiki also includes some Capistrano deploy script examples, so you can even have the server stop and start from your own machine.

Note: There are two daemon extensions. The one I have linked to is the new one, which uses a better daemonizing library.

GlassFish gem

You're right, the GlassFish gem isn't getting so much love right now, but I daresay things will improve. There are a couple of issues running it with JRuby 1.5+ because the gem didn't keep up with changes in JRuby, however I wrote about how to work around the issues here: http://www.scottlowe.eu/deploying-rails-3-with-jruby-daemonized-glass

Since writing that GlassFish post, Trinidad has gained the power to be dependably daemonized, so it's probably the smoother path to take today.

Scott Lowe
Could you elaborate on the "daresay things will improve"?
Thorbjørn Ravn Andersen
Thorbjørn, I went to a users meetup night with the JRuby guys a few weeks ago, and the GlassFish gem was discussed. Whilst nothing specific has been officially promised or announced, there was definitely a desire from the team to improve the situation in the near future. I wouldn't want to misrepresent the JRuby guys, so I probably shouldn't say any more. Hopefully one of them will comment here. Is that enough to answer your question?
Scott Lowe
thx for the links! Looks like Trinidad might be the winner right now with its daemon mode.
brad