在Heroku Cedar上使用“bundle install --local”

时间:2012-10-11 15:54:22

标签: ruby-on-rails heroku bundle bundler

我有一个最初在Bamboo上的应用程序。我已经将它更新为ruby 1.9并且摆脱了所有的依赖性。我正在尝试在Heroku上部署,但它失败了。

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.1
   Running: bundle install --without development:test --path vendor/bundle --binstubs bin/
   Fetching git@github.com:WaterfallFMS/deployment.git
   Host key verification failed.
   fatal: The remote end hung up unexpectedly
   Git error: command `git clone 'git@github.com:WaterfallFMS/deployment.git' "/tmp/build_2q1m86r0nc31g/vendor/bundle/ruby/1.9.1/cache/bundler/git/deployment-5959a7fb9f44c5cab5d6966441639b4e711bfc6b" --bare --no-hardlinks` in directory /tmp/build_2q1m86r0nc31g has failed.

我将此跟踪到捆绑器而非缓存git repos(https://github.com/carlhuda/bundler/issues/67)。如果你使用“bundle package --all”标志,它就被修复了。

问题是你必须使用“Bundle install --local”,否则它仍然会在缓存之前引用git repo。我无法弄清楚如何强迫heroku使用“--local”。

1 个答案:

答案 0 :(得分:1)

bundle install命令被硬编码到the Ruby buildpack

# runs bundler to install the dependencies
def build_bundler
  log("bundle") do
    bundle_without = ENV["BUNDLE_WITHOUT"] || "development:test"
    bundle_command = "bundle install --without #{bundle_without} --path vendor/bundle --binstubs bin/"
    # ...
    bundle_command += " --deployment"
    # ...
    puts "Running: #{bundle_command}"
    bundler_output << pipe("#{env_vars} #{bundle_command} --no-clean 2>&1")

最终,这很痛苦,因为你试图从存储库外部获取私有代码到slug中,这意味着slug编译器必须能够以某种方式获取代码。在我看来,你的选择是:

  1. 将buildpack分叉以与bundle package一起使用。有关详情,请参阅Buildpacks documentation
  2. 将Point Bundler指向https://username:password@github.com/username/repo。是的,那些是明文凭证。是的,他们会受到源头控制。
  3. 将代码放入公共仓库。可能不是一个选择。
  4. 以其他方式将代码放入Heroku repo中。您可以自己提供外部代码(不使用Bundler)并手动将其添加到加载路径中。
  5. 将代码放在私有gem存储库中。 Gemfury addon最近进入了测试阶段,确实如此,但您可以使用您想要的任何私人仓库。
相关问题