【问题标题】:Deploying Rails 4.1 in a subdirectory to Heroku?在 Heroku 的子目录中部署 Rails 4.1?
【发布时间】:2014-06-29 08:19:37
【问题描述】:

我的目录结构如下:

my-app/
  .git/
  db/    <-- Database stuff
  lib/   <-- Business logic
  spec/
  web/   <-- Rails

Rails 位于存储库的 web/ 子目录中。 Heroku 默认不喜欢这个。

我有一个partially working heroku buildpack。它基本上在运行任何任务之前调用Dir.chdir 更改为APP_SUBDIR 环境变量(如果存在)。

我想部署到 Heroku,但我无法让资产管道任务工作。当需要预编译资产时,自定义的 buildpack 会更改为 web/ 目录并尝试运行任务。

然而,I get this error,有以下重要的一点:

Could not detect rake tasks
ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
and using the production group of your Gemfile.
Your Ruby version is 1.9.2, but your Gemfile specified 2.0.0 (Bundler::RubyVersionMismatch)

这很奇怪,因为 Heroku 明确表示我在同一个馅饼中运行 2.0。事实上,当我运行时:

$ heroku run 'cd web; bundle exec rake -P'

它工作得很好。

TL;DR(摘要)

Heroku 认为我的 ruby​​ 版本是 1.9.2,而实际上是 2.0.0 shown in its own build process。为什么会这样?

【问题讨论】:

标签: ruby-on-rails heroku deployment asset-pipeline buildpack


【解决方案1】:

您只能将 Rails 应用程序所在的子目录推送到 Heroku:

git subtree push --prefix web heroku master

web 是子目录。

【讨论】:

    猜你喜欢
    • 2013-09-23
    • 2014-12-02
    • 1970-01-01
    • 2011-09-05
    • 2014-12-06
    • 1970-01-01
    • 1970-01-01
    • 2018-07-15
    • 2022-01-06
    相关资源
    最近更新 更多