Best way to deploy JRuby?
Solution 1:
Have you seen these tutorials...
- http://www.javaworld.com/community/node/2831
- http://www.ibm.com/developerworks/opensource/library/os-ad-prototype-jruby/
Solution 2:
May I offer a suggestion that you try the recent 4.0 beta release of Passenger Phusion for Open Source? It integrates with Apache and enables you to install JRuby Rack-based applications in one of your enabled sites.
http://blog.phusion.nl/2012/10/24/phusion-passenger-4-0-beta-1-is-here/
And
http://blog.phusion.nl/2013/01/24/phusion-passenger-4-0-beta-2-syscall-failure-simulation-framework-focus-on-stability/
Download the tarball from Google Code here:
$ curl -O http://phusion-passenger.googlecode.com/files/passenger-3.9.2.beta.tar.gz
$
$ JRUBY_OPTS="-Xcext.enabled=true" jruby ./bin/passenger-install-apache2-module
$ jgem install rack # Or jruby -S gem install rack
Next, add the following lines to your Apache configuration file (either apache.conf or the sites-enabled config file):
LoadModule passenger_module /usr/local/lib/passenger-3.9.2.beta/libout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/passenger-3.9.2.beta
PassengerRuby /usr/java/jruby/bin/jruby
PassengerSpawnMethod direct
Apparently, it can also integrate with nginx, but I cannot confirm that since I haven't tried it.
The Apache integration does indeed work well for me. Please note that this may not be an ideal enterprise setup. First, it's a beta release. Second, it is my understanding that the non-enterprise version of this passenger mod will not be multi-threaded. What that means precisely with respect to a JVM application does not make sense to me, but I haven't researched enough to determined if it is actually an issue. Also note that I am making this recommendation for those who are interested in getting something setup quickly, and specifically using an existing Apache installation.