LATEST VERSION: 1.10 - CHANGELOG
Pivotal Cloud Foundry v1.9

Ruby Buildpack

Page last updated:

Push Apps

This buildpack will be used if your app has a Gemfile and Gemfile.lock in the root directory. It will then use Bundler to install your dependencies.

If your Cloud Foundry deployment does not have the Ruby Buildpack installed, or the installed version is out of date, you can use the latest version with the command:

cf push my_app -b https://github.com/cloudfoundry/ruby-buildpack.git

For more detailed information about deploying Ruby applications see the following topics:

You can find the source for the buildpack on GitHub: https://github.com/cloudfoundry/cf-buildpack-ruby

Supported Versions

Supported Ruby versions can be found in the release notes.

Specify a Ruby Version

Specific versions of the Ruby runtime can be specified in the Gemfile:

MRI

For MRI you can specify the version of Ruby by doing the following:

ruby '2.2.3'

Beginning in Ruby Buildpack v1.6.18, Rubygems version operators are supported for the ruby directive. For example, the ~> pessimistic operator is also supported:

ruby '~> 2.2.3'

With this example declaration in the Gemfile, if Ruby versions 2.2.4, 2.2.5, and 2.3.0 are present in the Ruby buildpack, the app will use Ruby 2.2.5.

For more information about the ruby directive for Bundler Gemfiles, see Bundler’s documentation.

JRuby

For JRuby you can specify the version of ruby by doing the following:

JRuby version 1.7.x supports either 1.9 mode, e.g.:

ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.25'

or 2.0 mode, e.g.:

ruby '2.0.0', :engine => 'jruby', :engine_version => '1.7.25'

For Jruby version >= 9.0:

ruby '2.2.3', :engine => 'jruby', :engine_version => '9.0.5.0'

The buildpack only supports the stable Ruby versions, which are listed in the manifest.yml and releases page.

If you try to use a binary that is not currently supported, staging your app will fail and you will see the following error message:

       Could not get translated url, exited with: DEPENDENCY_MISSING_IN_MANIFEST: ...
 !
 !     exit
 !
Staging failed: Buildpack compilation step failed

Additionally, note that the pessimistic version operator (~>) on the Gemfile ruby directive for JRuby is not supported by the Ruby buildpack.

Vendor App Dependencies

As stated in the Disconnected Environments documentation, your application must ‘vendor’ its dependencies.

For the Ruby buildpack, use bundler:

cd <your app dir>
bundle package --all

cf push uploads your vendored dependencies. The buildpack will compile any dependencies requiring compilation while staging your application.

Buildpack Logging and Application Logging

The buildpack only runs during the staging process, and only logs what is important to staging, such as what is being downloaded, what the configuration is, and work that the buildpack does on your application.

The buildpack stops logging when the staging process finishes. The Loggregator handles application logging.

Your application must write to STDOUT or STDERR for its logs to be included in the Loggregator stream. For more information, see the Application Logging in Cloud Foundry topic.

If you are deploying a Rails application, the buildpack may or may not automatically install the necessary plugin or gem for logging, depending on the Rails version of the application:

  • Rails 2.x: The buildpack automatically installs the rails_log_stdout plugin into the application. For more information about the rails_log_stdout plugin, refer to the Github README.

  • Rails 3.x: The buildpack automatically installs the rails_12factor gem if it is not present and issues a warning message. You must add the rails_12factor gem to your Gemfile to quiet the warning message. For more information about the rails_12factor gem, refer to the Github README.

  • Rails 4.x: The buildpack only issues a warning message that the rails_12factor gem is not present, but does not install the gem. You must add the rails_12factor gem to your Gemfile to quiet the warning message. For more information about the rails_12factor gem, refer to the Github README.

For more information about the rails_12factor gem, refer to the Github README.

Proxy Support

If you need to use a proxy to download dependencies during staging, you can set the http_proxy and/or https_proxy environment variables. For more information, see the Proxy Usage Docs.

BOSH Configured Custom Trusted Certificate Support

Ruby uses certificates stored in /etc/ssl/certs and supports BOSH configured custom trusted certificates out of the box.

Help and Support

Join the #buildpacks channel in our Slack community if you need any further assistance.

For more information about using and extending the Ruby buildpack in Cloud Foundry, see the ruby-buildpack GitHub repo.

You can find current information about this buildpack on the Ruby buildpack release page in GitHub.

Create a pull request or raise an issue on the source for this page in GitHub