Deploying with JRuby: Deliver Scalable Web Apps using the JVM (Pragmatic Programmers)

Deploying with JRuby: Deliver Scalable Web Apps using the JVM (Pragmatic Programmers)

Joe Kutner

Language: English

Pages: 224

ISBN: 1934356972

Format: PDF / Kindle (mobi) / ePub


Deploy using the JVM's high performance while building your apps in the language you love. JRuby is a fast, scalable, and powerful JVM language with all the benefits of a traditional Ruby environment. See how to consolidate the many moving parts of an MRI-based Ruby deployment onto a single JVM process. You'll learn how to port a Rails application to JRuby, get it into production, and keep it running.

JRuby deployments have fewer moving parts and consume less memory than traditional Ruby deployments, but to deploy your apps on the JVM, you need to learn some new approaches. This book introduces you to three JRuby deployment strategies that will give you the performance and scalability you need while letting you use the language you love.

You'll start by porting an existing application to JRuby, preparing the app to take advantage of the JVM platform. Then you'll use Vagrant and Puppet to build a virtual production environment so you have a stable, reproducible place to explore JRuby deployment.

With your environment in place, you'll experiment with simple JRuby deployment with Warbler as you package your Ruby web application into a single file you can deploy to a Java application server. Next you'll set up the lightweight Trinidad web server to create a more flexible, modular deployment that fits more complex situations but still feels friendly and familiar to Ruby developers. You'll switch to powering your app with TorqueBox, an all-in-one JRuby environment that includes built-in support for messaging, scheduling, and daemons--perfect for handling the "big jobs." Then, you'll set up a continuous integration environment with Jenkins so you can deploy like the pros.

Deploying with JRuby is the missing link between enjoying JRuby and using it in the real world to build high-performance, scalable applications.

What You Need:

To run the examples in this book, you'll need a computer that can run the Java Virtual Machine.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

application. Run the migrate rake task. Deploy and run pending migrations. Displays the commits since your last deploy. Displays the `diff' since your last deploy. Rolls back to a previous version and restarts. Rolls back to the previously deployed version. Prepares one or more servers for deployment. Updates the symlink to the most recently deployed ... Copies your project and updates the symlink. Copies your project to the remote servers. Copy files to the currently deployed version. Present a

2. Cute fluffy animal.) We wish you every success with your business! - The Pandas Successfully installed engineyard-serverside-adapter-1.5.21 Successfully installed engineyard-1.4.15 2 gems installed 100 • Chapter 5. Deploying a Trinidad Application This will add the ey command to our path. To use it, change directories to the checked-out copy of the application from the Git repository. Then run the deploy command. $ ey deploy Loading application data from EY Cloud... Beginning deploy of ref

setting both the pool value and config.threadsafe! is actually redundant. Now we can deploy Twitalytics again with the torquebox deploy command. When the application boots, it will be using a shared pool (single instance) for the web runtime. But how do we know that is what it’s actually doing? At the least, it would be nice to inspect the pool to ensure it’s configured correctly without depending on the log file. This is important when using a shared pool, but it’s especially important when

DeleteOldStatuses Scheduling a Recurring Job • 113 def run ids = Status.where("created_at < ?", 30.days.ago) if ids.size > 0 Status.destroy(ids) puts "#{ids.size} statuses have been deleted!" else puts "No statuses have been deleted." end end end DeleteOldStatuses.new.run When Twitalytics was running on MRI, this background job was scheduled by adding a crontab entry and having the cron daemon run the script with the rails runner command. But that increased the complexity of our

declaratively make the post_udpate(text) method run from a thread pool. First, we’ll modify the CompanyController so that it extends the GetBack::JoJo module. JRuby/twitalytics/app/controllers/company_controller.rb class CompanyController < ApplicationController include TwitterUtil extend GetBack::JoJo 5. https://github.com/jkutner/get_back Preparing Twitalytics for JRuby • 11 Then, we’ll remove the call to the Kernel#fork() and tell the post_update(text) method to get back.

Download sample

Download