Skip to content

Instantly share code, notes, and snippets.

@mpage
Created April 30, 2011 21:08
Show Gist options
  • Save mpage/949995 to your computer and use it in GitHub Desktop.
Save mpage/949995 to your computer and use it in GitHub Desktop.
From 4d05ee7e1a8be2464e12027f3b2687accd4fc7a1 Mon Sep 17 00:00:00 2001
From: mpage <mpage@vmware.com>
Date: Sat, 30 Apr 2011 13:50:44 -0700
Subject: [PATCH] Fix runtimes for rails3 staging
---
cloud_controller/staging/rails3/plugin.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cloud_controller/staging/rails3/plugin.rb b/cloud_controller/staging/rails3/plugin.rb
index 0776a1a..fb569a1 100644
--- a/cloud_controller/staging/rails3/plugin.rb
+++ b/cloud_controller/staging/rails3/plugin.rb
@@ -13,7 +13,7 @@ class Rails3Plugin < StagingPlugin
if uses_bundler?
# Specify Thin if the app bundled it; otherwise let Rails figure it out.
server_script = thin? ? "server thin" : "server"
- "#{local_runtime} #{gem_bin_dir}/bundle exec rails #{server_script} $@"
+ "#{local_runtime} #{gem_bin_dir}/bundle exec #{local_runtime} #{gem_bin_dir}/rails #{server_script} $@"
else
"#{local_runtime} -S thin -R config.ru $@ start"
end
@@ -26,7 +26,7 @@ class Rails3Plugin < StagingPlugin
def migration_command
if uses_bundler?
- "#{local_runtime} #{gem_bin_dir}/bundle exec rake db:migrate --trace"
+ "#{local_runtime} #{gem_bin_dir}/bundle exec #{local_runtime} #{gem_bin_dir}/rake db:migrate --trace"
else
"#{local_runtime} -S rake db:migrate --trace"
end
--
1.7.1
@johnschult
Copy link

I patched the cloud_controller and restarted it. My dea.yaml is set up as:

runtimes:
  ruby18:
    executable: /home/deploy/.rvm/rubies/ruby-1.8.7-p334/bin/ruby
    version: 1.8.7
    version_flag: "-e 'puts RUBY_VERSION'"
    additional_checks: "-e 'puts RUBY_PATCHLEVEL >= 174'"
    environment:
  ruby19:
    executable: ruby
    version: 1.9.2
    version_flag: "-e 'puts RUBY_VERSION'"
    additional_checks: "-e 'puts RUBY_PATCHLEVEL >= 180'"
    environment:

If I push a new Rails app, it starts using /usr/bin/ruby1.8 still and if you specify --runtime=ruby19 it fails with:

Could not find rake-0.8.7 in any of the sources

@mpage
Copy link
Author

mpage commented May 2, 2011

If possible, would you be able to include a gist of the startup script generated for your rails app when staged with the ruby18 runtime? You can find this file on the dea at /var/vcap.local/dea/apps/<your app name>-<hash>/startup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment