Skip to content

TorqueBox for Production, but MRI for Development

December 5, 2012

So you want to run in production on Torquebox because you’ve been hearing about how great it is, but also hear it’s kind slow for development takes like running rake commands, etc.

Once you have Torquebox downloaded, let’s setup your -nix environment:

export TORQUEBOX_HOME=~/torquebox-2.x.incremental.1285
export JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=400m"
export JBOSS_HOME=$TORQUEBOX_HOME/jboss
export JRUBY_HOME=$TORQUEBOX_HOME/jruby
export PATH=$JRUBY_HOME/bin:$PATH

To get started, let’s create a new rails app using Torquebox.

gem install --no-ri --no-rdoc rails # This installs the latest Rails version into your JRuby environment that comes with Torquebox
torquebox rails your_torquebox_app # Creates and bundles your new app
cd your_torquebox_app
torquebox deploy . # This tells torquebox to startup this app when JBoss runs
torquebox run # Starts up the Rails app in Torquebox

I bet you noticed how slow Torquebox was starting up, and that’s unacceptable. But you really wanted to get all the multithreading performance out of JRuby, what to do? Well how about just using Torquebox for Production, and sticking to MRI/Passenger for development?

If you use rbenv/rvm, open a new shell and switch back to MRI.

rbenv local 1.9.3-p327
gem install --no-ri --no-rdoc passenger
passenger-install-(nginx|apache2)-module
configure nginx/passenger as you normally would. Run "bundle" and save that Gemfile.lock in source control.
Advertisements

From → Ruby

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: