Sunday, August 2, 2009

Which Deployment for JRuby on Rails?

We often get the question "which deployment option is the best for JRuby on Rails?" The truth is that it depends on what you need out of deployment.

If you have a fairly straightforward Rails app without a lot of service dependencies and a greenfield deployment target, your best bet is probably the GlassFish gem right now. It performs really well, can handle high loads and high concurrency, and automatically detects Rails' threadsafe mode, scaling better when it's turned on. I'm no longer a Sun employee, and I still think the GF gem is an outstanding piece of work. Here's my howto on GF gem + JRuby on Rails + Apache. Update: Here's information on using Capistrano with the GlassFish gem.

If you have an existing Java EE or web container like Tomcat, JBoss, GlassFish, WebLogic, or WebSphere, you want to look into Warbler. Warbler packages your application as a .war file, suitable for deployment on any of these standard servers. The Warbler wiki is the best place to learn about deploying with Warbler.

If you're looking for something that's somewhat greenfield but also needs more advanced services like scheduled asynchronous jobs, web services, and some level of EE integration, you should look at JBoss's TorqueBox, a customized JBoss specially tailored for deployment of Rack-based apps (like Rails) on JRuby.

If you're looking for a hosting provider that can take your app and make it "just work", then you should look into Engine Yard's JRuby cloud offering. We don't yet have it 100% ready to go, but it won't be long and it will be fantastic. For now you can give us some direction and input on what that hosting/cloud should look like.

All told, there's a lot of great options for JRuby deployment, and no one of them is going to be perfect for everyone. Choose wisely, and join the JRuby mailing lists if you have questions.


  1. For the Glassfish gem option, a short guide on starting/stopping glassfish with capistrano would be very welcome.

  2. Is it a good practice to host application on pure Glassfish server (not gem) without any additional webserver (like apache, nginx, etc)?

  3. May we know what is the solution of choice by Engine Yard ? Historically it does not seem to be one of the solution you advise. Why are they still using nginx/mongrel/rack/ruby/rails/merb stack and JRuby only for cloud ?