UPDATE: As of July 2011, JRuby on Engine Yard AppCloud is now available in public beta. For more information, review the Using JRuby on AppCloud Documentation.
As you may recall, we introduced the JRuby beta program a few weeks ago. Today, we’d like to provide more details about Trinidad, the application server used with the JRuby environment. In this post, we’ll explain how everybody can take advantage of Trinidad’s features and how to enable the best configuration options for our environment.
###The configuration file
Trinidad uses a YAML file for configuration. AppCloud generates a default file for each environment that can be overridden when we deploy the application. Here are the few options we add to this file:
These two lines mean that when we start Trinidad up it configures a runtime pool with at least two JRuby instances for our application. If you need a thread safe environment, you don’t have to worry because Trinidad disables these two options and uses a single runtime that works just fine with your thread safe application.
We keep this file under a shared directory, the same one where we keep the configuration files for the application, so we just need to add our custom trinidad.yml file under the application’s configuration directory and deploy the application as usual. Each time we modify the file, AppCloud will restart the server rather than perform a hot deploy, so our changes will be automatically applied.
We don’t apply any restriction to configure Trinidad, so any option or feature described on Trinidad’s wiki can be used on AppCloud, even extensions.
Introducing Trinidad diagnostics extension
Trinidad diagnostics is a plugin that uses JRuby-lint under the hood to inspect our application and let us know whether the application has any incompatibility issues to run with JRuby. For instance, if we will know if we are using a gem that’s not fully compatible with JRuby, or if we are using libraries which behavior diverges from MRI.
JRuby-lint generates an html report file with all the messages for our application, and the extension keeps it under the application’s public directory, thus, we can access it from a browser.
We just need two steps to enable this plugin for our AppCloud environment, actually the same two steps that we need to enable it for any other environment.
First, add the gem to the application’s Gemfile:
Second, add it to our custom configuration file:
After deploying the application again, we’ll have the generated report available under the path
###Recap In this post, we’ve just scratched the surface of all that Trinidad has to offer us. Whether we need to modify our HTTP connector to allow long non-blocking requests, or use an advanced task scheduler, we just need to add them to our custom configuration file.