开发者

What are some alternatives to using Tomcat for Jruby Rack apps?

开发者 https://www.devze.com 2023-01-20 08:29 出处:网络
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 howeve

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 comm开发者_如何学JAVAand 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?


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.


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消