3

AWS Elastic Beanstalk (EB) 환경에서 앱을 배포하려고 시도하는 동안 기본 보석이 설치되지 않습니다.보석 설치 중 오류 발생 - AWS Elastic Beanstalk

Don't run Bundler as root. Bundler can ask for sudo if it is needed, and 
    installing your bundle as root will break this application for all non-root 
    users on this machine. 
    Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. 
    fatal: Not a git repository (or any of the parent directories): .git 
    fatal: Not a git repository (or any of the parent directories): .git 
    Fetching gem metadata from https://rubygems.org/ 
    Fetching version metadata from https://rubygems.org/ 
    Fetching dependency metadata from https://rubygems.org/ 
    Resolving dependencies... 
    Installing rake 11.2.2 
    Installing i18n 0.7.0 
    Using json 1.8.3 
    Installing minitest 5.9.0 
    Installing thread_safe 0.3.5 
    Installing builder 3.2.2 
    Installing erubis 2.7.0 
    Installing mini_portile2 2.1.0 
    Installing pkg-config 1.1.7 
    Installing rack 1.6.4 
    Installing mime-types-data 3.2016.0521 
    Installing arel 6.0.3 
    Installing jmespath 1.3.1 
    Installing bcrypt 3.1.11 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     current directory: /var/app/ondeck/gems/bundle/gems/bcrypt-3.1.11/ext/mri 
    /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160916-26394-19gpiil.rb extconf.rb 
    Cannot allocate memory - /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160916-26394-19gpiil.rb extconf.rb 2>&1 

    Gem files will remain installed in /var/app/ondeck/gems/bundle/gems/bcrypt-3.1.11 for inspection. 
    Results logged to /var/app/ondeck/gems/bundle/extensions/x86_64-linux/2.3.0-static/bcrypt-3.1.11/gem_make.out 
    Using bundler 1.12.1 
    Installing rubyzip 1.2.0 
    Installing coderay 1.1.1 
    Installing coffee-script-source 1.10.0 
    Installing execjs 2.7.0 
    Installing thor 0.18.1 
    Installing concurrent-ruby 1.0.2 
    Installing orm_adapter 0.5.0 
    Installing unf_ext 0.0.7.2 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     current directory: /var/app/ondeck/gems/bundle/gems/unf_ext-0.0.7.2/ext/unf_ext 
    /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160916-26394-1kl25wy.rb extconf.rb 
    Cannot allocate memory - /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160916-26394-1kl25wy.rb extconf.rb 2>&1 

    Gem files will remain installed in /var/app/ondeck/gems/bundle/gems/unf_ext-0.0.7.2 for inspection. 
    Results logged to /var/app/ondeck/gems/bundle/extensions/x86_64-linux/2.3.0-static/unf_ext-0.0.7.2/gem_make.out 
    Installing hashie 3.4.4 
    Installing htmlentities 4.3.4 
    Installing multi_xml 0.5.5 
    Installing multi_json 1.12.1 
    Installing jwt 1.5.4 
    Installing method_source 0.8.2 
    Installing mimemagic 0.3.0 
    Installing mqtt 0.4.0 
    Installing netrc 0.11.0 
    Installing pg 0.18.4 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     current directory: /var/app/ondeck/gems/bundle/gems/pg-0.18.4/ext 
    /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160916-26394-4s0qe7.rb extconf.rb 
    Cannot allocate memory - /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160916-26394-4s0qe7.rb extconf.rb 2>&1 

    Gem files will remain installed in /var/app/ondeck/gems/bundle/gems/pg-0.18.4 for inspection. 
    Results logged to /var/app/ondeck/gems/bundle/extensions/x86_64-linux/2.3.0-static/pg-0.18.4/gem_make.out 
    Installing slop 3.6.0 
    Installing rack-cors 0.4.0 
    Installing sass 3.4.22 
    Installing tilt 2.0.5 
    Installing turbolinks-source 5.0.0 
    Installing will_paginate 3.1.0 
    Installing apipie-rails 0.3.6 
    Installing rdoc 4.2.2 
    Installing tzinfo 1.2.2 
    Installing nokogiri 1.6.8 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

     current directory: /var/app/ondeck/gems/bundle/gems/nokogiri-1.6.8/ext/nokogiri 
    /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160916-26394-13djrm9.rb extconf.rb 
    Cannot allocate memory - /opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160916-26394-13djrm9.rb extconf.rb 2>&1 

    Gem files will remain installed in /var/app/ondeck/gems/bundle/gems/nokogiri-1.6.8 for inspection. 
    Results logged to /var/app/ondeck/gems/bundle/extensions/x86_64-linux/2.3.0-static/nokogiri-1.6.8/gem_make.out 
    Installing rack-test 0.6.3 
    Installing warden 1.2.6 
    Installing mime-types 3.1 
    Installing aws-sdk-core 2.6.1 
    An error occurred while installing bcrypt (3.1.11), and Bundler cannot continue. 
    Make sure that `gem install bcrypt -v '3.1.11'` succeeds before bundling. (Executor::NonZeroExitStatus) 

EB-activity.log 나는 다음과 같은 시도 :

  1. EB에 /var/app/current 디렉토리와는 전혀 개선하지를 gem update bundler 명령을 사용하여 업데이트 들러.
  2. 로컬에서 gemfile.lockbundle install을 제거하고 배포하면 gemfile.lock이 업데이트됩니다.

위의 동일한 오류가 매번 발생합니다.

Ruby 2.3 버전의 레일 4.2.4을 사용하고 있습니다.

도와주세요. 감사.

답변

5

나는 보석을 캐싱하여 마침내 문제를 해결했다.

나는 로컬에서 bundle package을 실행했으며 vendor/cache 디렉토리에 보석 캐시를 생성합니다.

이제 캐시 된 보석으로 AWS에 배치하는 동안 캐시 된 보석을 설치하는 대신 캐시 된 보석을 사용하려고합니다. 좋은 연습인지는 모르겠지만 문제가 해결되었습니다.

나는 AWS 블로그에서이 솔루션을 가지고 : Locally Packaging Gem Dependencies for Ruby Applications in Elastic Beanstalk

편집 # 1 : 주시기 바랍니다 더 나은 솔루션이 있다면 대답 @의 sybind의 코멘트를 추가

bundle package --allall :git references

포함됩니다 나도 알아.

+2

번들 패키지 - 모두 포함됩니다 : git references – sybind

+0

@sybind, Thanks .. –