Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Background: I'm developing a Ruby web application, and have decided to switch to JRuby for several reasons that I'm not going to mention here. I have experience with servers such as Apache and Lighttpd, but I have no experience with Java or deploying Java-based web applications.

What would be the best setup for a JRuby web application in terms of server software? (And whatever else I might need.) What server choices do I have? What's different between setting up a Java-based server and, say, Apache? In other words, how do I get started?

Thanks for helping out a newbie. :)

PS: I don't know if it makes a difference since Java is cross-platform, but my development machine runs Vista, so it would be great if I could also use the same setup on Windows for development.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Have you seen these tutorials...

share|improve this answer
    
No, I haven't. Thank you! –  Sasha Chedygov May 30 '09 at 19:34
    
You're welcome =) –  Xerxes May 31 '09 at 1:26

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.

share|improve this answer

I've been looking into doing this myself, and I'm in a similar boat to the original poster -- plenty of experience running a LAMP stack, but needing to move to JRuby and having precisely nil Java experience.

I've decided to stick fairly closely to how my current Rails apps run (thin behind Apache and mod_proxy_balancer), by putting a Jetty 6 instance behind Apache and mod_proxy.

I looked into GlassFish, and while it was very easy to set up and get running, it's far too much for my needs -- the only part of the Java EE stack I actually need is the servlet container.

This isn't in production yet, but what I should end up with is Apache run by my distro's init scripts, Jetty started by capistrano and/or the init scripts, and everything watched by monit. This is similar enough to how things currently work that I'm comfortable with it, and the only real "eww, Java" moment I've had is working with Jetty's XML configuration file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.