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

发布于 2024-12-25 09:40:55 字数 406 浏览 7 评论 0原文

我尝试了这个技巧: https://github.com/thoughtbot/laptop/pull/ 14#issuecomment-3192270

在部署时我看到

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

但我的日志显示环境变量不受尊重

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

Hacky/实验解决方案已接受!

编辑:我在雪松堆上。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

白馒头 2025-01-01 09:40:55

这是针对引用此问题的每个人的更新...Heroku 现在允许您在 Gemfile 中指定您的 ruby​​ 版本,这要归功于它们添加到最新版本的捆绑程序中。

第一次运行:

gem install bundler --pre

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

source 'http://rubygems.org'

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

Heroku 的完整版本及其详细信息位于 http://blog.heroku.com /archives/2012/5/9/multiple_ruby_version_support_on_heroku/

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/

殊姿 2025-01-01 09:40:55

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

其实很简单;

  1. 启用 Heroku Labsuser_env_compile 为您的应用程序提供功能。

  2. 将heroku配置变量设置为RUBY_VERSION to ruby​​-1.9.3-p0 (heroku config:add RUBY_VERSION=ruby-1.9.3-p0)

  3. 确保heroku PATH 配置变量的前面有 bin (heroku config:add PATH=bin:vendor/ bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin)

当您下次部署时,您应该会看到您的应用程序使用 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

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
顾忌 2025-01-01 09:40:55

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

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/

寒冷纷飞旳雪 2025-01-01 09:40:55

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

我按照以下步骤操作
http://railsapps.github.com/rails-heroku-tutorial.html

遇到 1.9.3 和 openssl 在本地出现问题

但能够部署应用程序并正常运行
http://mccaffrey-rails32-193.herokuapp.com

中没有 Procfile

Thin 和 pg

Gemfile I 添加了一些调试输出,以便您可以看到 Rails 和 ruby​​ 版本信息

基本 Rails 应用程序 slug 大小为 28.9MB,这太疯狂了!

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!

厌倦 2025-01-01 09:40:55

我遇到了同样的问题:在 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

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
安人多梦 2025-01-01 09:40:55

根据 Heroku Cedar 堆栈定义此处 Cedar 目前仅支持 MRI 1.9.2。您是否尝试过联系 Heroku 支持人员?他们通常反应灵敏。

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文