Robert K. wrote:
No no, I meant, using Tomcat, Jetty or the like with JRuby. Sorry, the
question was definitively not precise enough.
Well, they both work great as far as I know. In Tomcat’s case, you would
use Warbler to package up your app as a .war file and then deploy that.
I believe Jetty can work the same way, though there’s also a jetty_rails
gem that’s similar to the glassfish gem.
Erm, what do you mean by that? With a proper configuration and JRuby’s
libraries deployed starting Tomcat should be enough. What am I missing?
Well, managing a Tomcat instance isn’t as simple as just running one
command. With JRuby you have exactly one process for your whole app,
and if you can run Rails with config.threadsafe! enabled, you have
exactly one JRuby instance within that process. Just about as easy as
Maybe it’s worth showing the steps to run JRuby behind Apache here:
- Apache with mod_proxy_http enabled (sudo a2enmod proxy_http on
Ubuntu). Every default apache I know ships with mod_proxy_http.
- Java (on Debian/Ubuntu)sudo apt-get install sun-java6-jdk or the
openjdk flavors if you like)
- JRuby (download, unpack, put bin/ in PATH)
- gems appropriate to run your app with JRuby (e.g. rails,
- production DB all set to go
Once you have that, the remaining set up is trivial:
Install the glassfish gem (or you can use Mongrel too…see my post):
gem install glassfish
From your application directory, run glassfish with these options:
glassfish -p -e production -c -d
Add ProxyPass and ProxyPassReverse lines to Apache (whereever is
appropriate on your system) for the GlassFish server instance. For
example, if is 9000 and is foo:
ProxyPass /foo http://localhost:9000/foo
ProxyPassReverse /foo http://localhost:9000/foo
Reload Apache config, however is appropriate for your system