Thursday, March 29, 2012

Clustering TorqueBox

I've create a new screencast to go with the second Beta release of my book.

In this video, I demonstrate how TorqueBox scheduled jobs can be run in a cluster without duplicating the job across nodes.

To run the examples I've shown in the video, you'll need to install the torquebox-server gem to your JRuby runtime:

Here are the commands and code I run in the video:

Thursday, March 15, 2012

Talkin' about JRuby

I gave a talk today at hsv.rb on the subject of my book. The video, slides and code samples are below. Enjoy!

Deploying with JRuby
View more presentations from jkutner

Saturday, March 10, 2012

Deploying with Trinidad on Heroku

Heroku is an excellent platform for JRuby deployment, but it only provides indirect support for JRuby through it's Java stack. As a result, deployment on Heroku requires some XML, a little knowledge of Maven, and bunch of hacky-feeling tricks. That's why I chose not to include a detailed discussion of it in my book. Instead, I thought it would make a nice blog post.

I've created the simplest possible Rack application that can be deployed on Heroku with Trinidad and JRuby <>. The key elements are these:
  • pom.xml - this is a Maven config file that can be copied as is (in most cases).
  • Jemfile - a renamed Gemfile so that Heroku doesn't think this is an MRI app.
  • Procfile - a Heroku config file with instructions for running the app.
  • script/jruby - a modified jruby executable for the Heroku platform.
  • - the application itself (can be replaced with any Rack app)
Once your application has these components, you'll need to create the Heroku application by running this command from the application root:

The first thing you'll notice is that we are creating an app on the Heroku Cedar stack. This provides the Java platform support. We're also using a buildpack takes care of setting up the essentials for any Java application on Heroku (most importantly is making sure the Maven dependencies are available at runtime).

Then you can deploy with this command:

There is a slightly out-dated post by Chris Howie on deploying Sinatra on a Trinidad, JRuby, Heroku stack. There is also an example application called Punchy that has been ported to Heroku by Mathew Rodley. Heroku has changed it's configuration since these were created, but the basics hold true. They are worth reading.

In addition to Heroku's lack of native JRuby support, it also lacks native support for Trinidad. So it's unclear how many of the Trinidad extensions will function. This is unfortunately because the Trinidad extension are a big part of why this platform is superior to almost every MRI-based server.

In the future, I will investigate Trinidad extensions on Heroku and follow up with another post.


This is the official blog for the book Deploying with JRuby by Joe Kutner. I'll be making regular posts here that address topics associated with the book, but not necessarily covered in the book.

The most common questions I've received about the book are: "does it cover Heroku?" and "does it cover Google AppEngine?" I've chosen not to provide detailed coverage of these platforms in the book, but they are still excellent choices for JRuby deployment. As a result, I hope to post some tutorials of how to use them on this blog.

I'll also be posting updates on new platforms, and some less mainstream server technologies that can be used for deploying JRuby.

Stay tuned for more!