Note
See Heroku Buildpack for an alternative way to deploy Ruby on Rails applications.
The stackato.yml must specify the Ruby runtime version and Rails as the framework type:
framework:
runtime: ruby19
Default supported ruby version is Ruby 1.8.7.
Rmagick gem currently not supported.
PostgreSQL Gem (pg) version must be pinned to 0.12.2 (if used):
gem 'pg', '0.12.2'
Must specify Rake Gem immediately before the line loading rails. This happens because when Rails loads, it finds version 0.9.2 of Rake, and that becomes the only version of Rake in the process. Later code wants version 0.9.2.2, and fails:
gem 'rake', '0.9.2.2'
gem 'rails'
For Ruby 1.9 Cloud Foundry requires a tweak to the jquery-rails gem.
gem 'cloudfoundry-jquery-rails'
To get the asset pipeline working on Stackato, precompile your assets in your development environment, which compiles them into public/assets:
bundle exec rake assets:precompile
A Gemfile must be included in your app that lists all required gems. Run:
$ bundle install
$ bundle package
any time you modify the Gemfile and prior to pushing an app to Stackato.
If VCAP sees a Gemfile.lock in the application, it will ensure the needed gems are packaged, and set the BUNDLE_PATH environment variable to point at them.
Unsupported Gemfile features:
Cloud Foundry supports database auto-reconfiguration for Rails applications.
Non-HTTP apps that run as a Stackato application under the control of the Health Manager.
To deploy worker applications, you need to use the command key and set the proceses: web key to Null ("~").
name: ruby-app
framework:
type: rails3
runtime: ruby19
command: ruby worker.rb
processes:
web: ~
For the best performance, using Thin Ruby web server is recommended. Include gem 'thin' in your Gemfile.
First, you need bundler and rails installed locally. This can be done via:
$ sudo gem install rails bundler --no-ri --no-rdoc
Generally, bundle exec must be used when running any commands that are installed through Gemfile/bundler.
To run rake stats, for instance, use the stackato run command:
$ stackato run *appname* bundle exec rake stats
See the Command Reference for details on the use of stackato run.