【问题标题】:Cedar-14 bundle fails: Could not load OpenSSLCedar-14 捆绑包失败:无法加载 OpenSSL
【发布时间】:2015-08-06 17:10:34
【问题描述】:

我正在将 Heroku 上的生产应用程序升级到 Cedar-14。我分叉了我的暂存应用程序heroku fork -a v-upgrade v-upgrade2,验证了分叉版本已在 Cedar-10 上启动并运行,将堆栈设置为 Cedar-14,创建了一个虚拟提交,并在推送时收到以下信息:

~/documents/coding/cycling/velopro$ git push upgrade2 currentdev:master
Counting objects: 11833, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7014/7014), done.
Writing objects: 100% (11833/11833), 91.20 MiB | 1.05 MiB/s, done.
Total 11833 (delta 8521), reused 6407 (delta 4535)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Fetching custom git buildpack... done
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.0
remote: -----> Installing gsl
remote: -----> Installing dependencies using 1.9.7
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Could not load OpenSSL.
remote:        You must recompile Ruby with OpenSSL support or change the sources in your
remote:        Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
remote:        RVM are available at rvm.io/packages/openssl.
remote:        Bundler Output:
remote:        Could not load OpenSSL.
remote:        You must recompile Ruby with OpenSSL support or change the sources in your
remote:        Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
remote:        RVM are available at rvm.io/packages/openssl.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to v-upgrade2.
remote: 
To git@heroku.com:v-upgrade2.git
 ! [remote rejected] currentdev -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:v-upgrade2.git'

我再次确认我仍然可以毫无问题地推送到 Heroku 上的原始暂存应用程序 (v-upgrade),因此它们之间的唯一区别似乎是 Cedar 堆栈。

有没有其他人遇到过在 Cedar-14 上加载 OpenSSL 的捆绑程序问题?有没有办法在 Heroku 上“使用 OpenSSL 支持重新编译 Ruby”?

提前感谢您的帮助!

【问题讨论】:

    标签: ruby heroku openssl bundler


    【解决方案1】:

    最后,我下注了。我使用的 buildpack 有一段时间没有更新了,所以我没有尝试修复它,而是简单地 fork heroku-buildpack-ruby 并添加了几行代码来包含我需要的 GSL 库,如下所示:

    /Rakefile

    +  GSL_VENDOR_URL   = "https://s3.amazonaws.com/gsl_bin/gsl-1.15.tgz"
    

    /lib/language_pack/ruby.rb

     class LanguagePack::Ruby < LanguagePack::Base
    +  GSL_VENDOR_URL       = "https://s3.amazonaws.com/gsl_bin/gsl-1.15.tgz"
       NAME                 = "ruby"
       LIBYAML_VERSION      = "0.1.6"
       LIBYAML_PATH         = "libyaml-#{LIBYAML_VERSION}"
    @@ -57,7 +58,8 @@ class LanguagePack::Ruby < LanguagePack::Base
       def default_config_vars
         instrument "ruby.default_config_vars" do
           vars = {
    -        "LANG" => env("LANG") || "en_US.UTF-8"
    +        "LANG" => env("LANG") || "en_US.UTF-8",
    +        "LD_LIBRARY_PATH" => ld_path,
           }
    
           ruby_version.jruby? ? vars.merge({
    @@ -88,6 +90,9 @@ class LanguagePack::Ruby < LanguagePack::Base
           setup_export
           setup_profiled
           allow_git do
    +        install_gsl
    +        run("cp -R vendor/gsl-1 /app/vendor/gsl")
    +        run("cp -R vendor/gsl-1 /app/vendor/gsl-1")
             install_bundler_in_app
             build_bundler
             post_bundler
    @@ -111,6 +116,7 @@ private
         paths         = [
           ENV["PATH"],
           "bin",
    +      "/app/vendor/gsl-1/bin",
           system_paths,
         ]
         paths.unshift("#{slug_vendor_jvm}/bin") if ruby_version.jruby?
    @@ -119,6 +125,10 @@ private
         paths.join(":")
       end
    
    +  def ld_path
    +    "/app/vendor/gsl-1/lib"
    +  end
    +
       def binstubs_relative_paths
         [
           "bin",
    @@ -459,6 +469,15 @@ ERROR
         FileUtils.rm File.join('bin', File.basename(path)), :force => true
       end
    
    +  def install_gsl
    +    topic("Installing gsl")
    +    bin_dir = "vendor/gsl-1"
    +    FileUtils.mkdir_p bin_dir
    +    Dir.chdir(bin_dir) do |dir|
    +      run("curl #{GSL_VENDOR_URL} -s -o - | tar xzf -")
    +    end
    +  end
    

    最后,虽然弄清楚加载 OpenSSL 出了什么问题可能并没有那么令人激动,但无论如何这可能是更好的方法。

    【讨论】:

      猜你喜欢
      • 2019-06-01
      • 2016-01-15
      • 2016-12-17
      • 2023-02-10
      • 2012-05-29
      • 2011-11-07
      • 2021-04-23
      相关资源
      最近更新 更多