0

もともとBambooにあったアプリがあります。私はそれをruby1.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リポジトリをキャッシュしていないbundler(https://github.com/carlhuda/bundler/issues/67)まで追跡しました。「bundlepackage--all」フラグを使用すると修正されました。

問題は、「Bundle install --local」を使用する必要があることです。そうしないと、キャッシュの前にgitリポジトリが参照されます。herokuに「--local」を強制的に使用させる方法がわかりません。

4

1 に答える 1

1

bundle installコマンドはRubyビルドパックにハードコードされています:

# 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")

最終的には、リポジトリの外部からスラッグにプライベートコードを取得しようとしているため、これは苦痛です。つまり、スラッグコンパイラは何らかの方法でコードを取得できる必要があります。私が見ているように、あなたのオプションは次のとおりです。

  1. ビルドパックをフォークして使用しbundle packageます。詳細については、Buildpacksのドキュメントを参照してください。
  2. Bundlerをにポイントしhttps://username:password@github.com/username/repoます。はい、それらはプレーンテキストのクレデンシャルです。はい、それらはソース管理下にあります。
  3. コードを公開リポジトリに配置します。おそらくオプションではありません。
  4. 別の方法でコードをHerokuリポジトリに配置します。(Bundlerを使用せずに)外部コードを自分でベンダー化し、手動でロードパスに追加することができます。
  5. コードをプライベートgemリポジトリに配置します。Gemfuryアドオンは最近ベータ版になり、まさにこれを実行しますが、任意のプライベートリポジトリを使用できます。
于 2012-10-11T16:11:38.680 に答える