是否可以使用Ruby 1.9.3在Heroku上运行我的Rails应用程序?如果是这样,怎么样?

时间:2021-09-06 21:38:30

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

我试过这个提示: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!

接受Hack​​y /实验解决方案!

Edit: I am on the cedar stack.

编辑:我在雪松堆上。

6 个解决方案

#1


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.

以下是每个引用此问题的人的更新... Heroku现在允许您在Gemfile中指定ruby版本,这要归功于它们添加到最新版本的bundler。

First run:

第一次运行:

gem install bundler --pre

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

然后将ruby'1.9.3'添加到你的Gemfile中。

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/

Heroku的完整版本详情请访问http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/

#2


8  

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

是的,所以Ruby 1.9.3肯定是可能的。正如你所说的hacky /实验解决方案被接受 - 这绝对是其中之一。

It's actually really simple;

它实际上非常简单;

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

    为您的应用程序启用Heroku Labs的user_env_compile功能。

  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)

    将heroku配置变量设置为RUBY_VERSION为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)

    确保heroku PATH配置变量在前面有bin(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;

下次部署时,您应该使用1.9.3查看您的应用程序 - 部署输出也会显示此信息;

-> 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

#3


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/

从5月10日开始,可以更轻松地使用Ruby 1.9.3。只需看看Heroku的博客:http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/

#4


1  

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

我今天能够在Heroku雪松上的Ruby 1.9.3-p0上运行Rails 3.2应用程序

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

我按照http://railsapps.github.com/rails-heroku-tutorial.html上的步骤进行操作

ran into a problem locally with 1.9.3 and openssl

用1.9.3和openssl在本地遇到了问题

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

但是能够获得部署并运行的应用程序http://mccaffrey-rails32-193.herokuapp.com

no Procfile

没有Procfile

thin and pg in Gemfile

在Gemfile中瘦和pg

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

我添加了一些调试输出,因此您可以看到rails和ruby版本信息

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

它的疯狂基本的rails应用程序slug大小是28.9MB!

#5


1  

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

我遇到了同样的问题:在我的Gemfile中指定1.9.3,但它使用的是1.9.2。这解决了它:

heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin

#6


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.

根据Heroku Cedar堆栈定义,Cedar目前仅支持MRI 1.9.2。您是否尝试过联系Heroku支持?他们通常很敏感。

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.

编辑:有时可以“愚弄”平台运行一些二进制文件,比如在Heroku上运行Haskell,所以如果你真的很专注,你可以打包一些东西。我想这对于MRI来说并不容易。

#1


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.

以下是每个引用此问题的人的更新... Heroku现在允许您在Gemfile中指定ruby版本,这要归功于它们添加到最新版本的bundler。

First run:

第一次运行:

gem install bundler --pre

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

然后将ruby'1.9.3'添加到你的Gemfile中。

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/

Heroku的完整版本详情请访问http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/

#2


8  

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

是的,所以Ruby 1.9.3肯定是可能的。正如你所说的hacky /实验解决方案被接受 - 这绝对是其中之一。

It's actually really simple;

它实际上非常简单;

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

    为您的应用程序启用Heroku Labs的user_env_compile功能。

  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)

    将heroku配置变量设置为RUBY_VERSION为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)

    确保heroku PATH配置变量在前面有bin(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;

下次部署时,您应该使用1.9.3查看您的应用程序 - 部署输出也会显示此信息;

-> 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

#3


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/

从5月10日开始,可以更轻松地使用Ruby 1.9.3。只需看看Heroku的博客:http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/

#4


1  

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

我今天能够在Heroku雪松上的Ruby 1.9.3-p0上运行Rails 3.2应用程序

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

我按照http://railsapps.github.com/rails-heroku-tutorial.html上的步骤进行操作

ran into a problem locally with 1.9.3 and openssl

用1.9.3和openssl在本地遇到了问题

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

但是能够获得部署并运行的应用程序http://mccaffrey-rails32-193.herokuapp.com

no Procfile

没有Procfile

thin and pg in Gemfile

在Gemfile中瘦和pg

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

我添加了一些调试输出,因此您可以看到rails和ruby版本信息

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

它的疯狂基本的rails应用程序slug大小是28.9MB!

#5


1  

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

我遇到了同样的问题:在我的Gemfile中指定1.9.3,但它使用的是1.9.2。这解决了它:

heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin

#6


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.

根据Heroku Cedar堆栈定义,Cedar目前仅支持MRI 1.9.2。您是否尝试过联系Heroku支持?他们通常很敏感。

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.

编辑:有时可以“愚弄”平台运行一些二进制文件,比如在Heroku上运行Haskell,所以如果你真的很专注,你可以打包一些东西。我想这对于MRI来说并不容易。