13

I tried this tip: https://github.com/thoughtbot/laptop/pull/14#issuecomment-3192270 .

On deploy I see

-----> Using RUBY_VERSION: ruby-1.9.3-p0

But my logs show the environment variable is not respected

INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]

Hacky / experimental solutions accepted!

Edit: I am on the cedar stack.

Gabe Kopley
  • 16,281
  • 5
  • 47
  • 60
  • Have you tried moving to the cedar stack? – sethvargo Jan 09 '12 at 06:12
  • Yup, am on it already, updated question :) – Gabe Kopley Jan 09 '12 at 06:33
  • I currently have a support ticket open in regards to this exact scenario - RUBY_VERSION output 1.9.2 but I'm explicitly requiring 1.9.3. Will post back when I get a response. – John Beynon Jan 09 '12 at 13:44
  • Here's a detailed tutorial that shows how to set up Ruby 1.9.3 on Heroku: [Using Rails 3.2 and Ruby 1.9.3 on Heroku](http://railsapps.github.com/rails-heroku-tutorial.html) It covers deploying an app to Heroku in depth. – Daniel Kehoe Jan 26 '12 at 19:16

6 Answers6

18

Here's an update for everyone referencing this question... Heroku now allows you to specify your ruby version in your Gemfile, thanks to their addition to the latest version of bundler.

First run:

gem install bundler --pre

then add ruby '1.9.3' to your Gemfile as such.

source 'http://rubygems.org'

ruby '1.9.3'
gem  'rails', '3.2.3'

The full release from Heroku with details is at http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/

Glenn
  • 1,092
  • 1
  • 10
  • 22
  • I've tried this after my app was set up with rails 1.9.1. Now i'm getting an error at run time which references `/app/vendor/bundle/ruby/1.9.1` instead of `1.9.3` which is the version i've updated it to. Thoughts? Oh, and when I check version with `heroku run "ruby -v"` it returns the expected `ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]` – alockwood05 Jun 05 '13 at 02:57
  • Thanks for gettign back, I actually discovered my error was unrelated to the rails version. It appears that I am infact running 1.9.3 even though my bundled gems are in the `/app/vendor/bundle/ruby/1.9.1` folder on heroku. My issue it seems to be is caused by ActiveAdmin (devise) and `sass-rails` and `haml-rails` gems being inside the `:assets` group. I took them out and it looks like I am working. So Infact I have no issue with running `1.9.3`, only the gems were stored in the old `1.9.1` labeled folder. – alockwood05 Jun 05 '13 at 22:42
9

Right, so Ruby 1.9.3 is definitely possibly. As you said hacky/experimental solutions were accepted - this is definitely one of them.

It's actually really simple;

  1. Enable Heroku Labs's user_env_compile feature for your application.

  2. Set a heroku config variable to RUBY_VERSION to ruby-1.9.3-p0 (heroku config:add RUBY_VERSION=ruby-1.9.3-p0)

  3. ENSURE that the heroku PATH config variable has bin at the front (heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin)

When you next deploy you should see your application using 1.9.3 - the deployment output will show this too;

-> Heroku receiving push
-----> Ruby/Rails app detected
-----> Using RUBY_VERSION: ruby-1.9.3-p0
-----> Installing dependencies using Bundler version 1.1.rc.7
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
wuputah
  • 11,285
  • 1
  • 43
  • 60
John Beynon
  • 37,398
  • 8
  • 88
  • 97
5

Since May 10 it is possible to use Ruby 1.9.3 in an easier way. Just take a look at Heroku's blog: http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/

Holger Frohloff
  • 1,695
  • 18
  • 29
1

I had the same problem: Specifying 1.9.3 in my Gemfile, but it was using 1.9.2. This fixed it:

heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
nicholaides
  • 19,211
  • 12
  • 66
  • 82
1

I was able to get a Rails 3.2 app running on Ruby 1.9.3-p0 on Heroku cedar today

I followed the steps on http://railsapps.github.com/rails-heroku-tutorial.html

ran into a problem locally with 1.9.3 and openssl

but was able to get an app deployed and working http://mccaffrey-rails32-193.herokuapp.com

no Procfile

thin and pg in Gemfile

I added some debug output so you can see the rails and ruby version info

Its crazy that a basic rails app slug size is 28.9MB!

J_McCaffrey
  • 1,455
  • 12
  • 15
0

According to the Heroku Cedar stack definition here Cedar currently only supports MRI 1.9.2. Have you tried contacting Heroku support? They're generally pretty responsive.

Edit: it's possible to 'fool' the platform sometimes into running some binaries such as running Haskell on Heroku so if you're feeling really dedicated you might be able to package something up. I imagine this isn't too easy with MRI though.

Community
  • 1
  • 1
Dave Kapp
  • 301
  • 1
  • 7