简体   繁体   English

AWS Elastic Beanstalk Rails Bundler失败

[英]AWS Elastic Beanstalk Rails Bundler Failing

I'm using the eb CLI to install my rails app on AWS. 我正在使用eb CLI在AWS上安装我的rails应用程序。 I've gotten a test one to work before, but now I'm trying to deploy some actual code that I wrote. 我之前有一个测试工作,但现在我正在尝试部署我写的一些实际代码。 When I do git aws.push, the update fails. 当我执行git aws.push时,更新失败。 "eb logs" command shows that the bundler failed. “eb logs”命令显示捆绑程序失败。

I am running this on 64bit Amazon Linux 2014.03 v1.0.0 running Ruby 2.1 (Puma) 我在64位运行Ruby 2.1(Puma)的Amazon Linux 2014.03 v1.0.0上运行

Fetching source index from https://rubygems.org/
Using rake (10.3.2) 
Using i18n (0.6.11) 
Using minitest (4.7.5) 
Using multi_json (1.10.1) 
Using thread_safe (0.3.4) 
Using tzinfo (0.3.41) 
Using activesupport (4.0.8) 
Using builder (3.1.4) 
Using erubis (2.7.0) 
Using rack (1.5.2) 
Using rack-test (0.6.2) 
Using actionpack (4.0.8) 
Using mime-types (1.25.1) 
Using polyglot (0.3.5) 
Using treetop (1.4.15) 
Using mail (2.5.4) 
Using actionmailer (4.0.8) 
Using activemodel (4.0.8) 
Using active_model_serializers (0.9.0) 
Using activerecord-deprecated_finders (1.0.3) 
Using arel (4.0.2) 
Using activerecord (4.0.8) 
Using addressable (2.3.6) 
Using execjs (2.2.1) 
Using autoprefixer-rails (3.0.1.20140826) 
Installing bcrypt (3.1.7) 
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /opt/rubies/ruby-2.1.2/bin/ruby extconf.rb 
Cannot allocate memory - /opt/rubies/ruby-2.1.2/bin/ruby extconf.rb  2>&1

Gem files will remain installed in /opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7 for inspection.
Results logged to /opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/bcrypt-3.1.7/gem_make.out
An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.

2014-09-03 00:22:36,561 [ERROR] (3331 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed with returncode 5

I'm not calling bcrypt in my gem file either. 我也不是在我的gem文件中调用bcrypt。 It must be a dependency of the sorcery gem. 它必须是巫术宝石的依赖。

I've attempted to use the "bundle package" for the vendor/cache trick, but it kept saying some gems were missing on AWS. 我试图将“捆绑包”用于供应商/缓存技巧,但它一直在说AWS上缺少一些宝石。 As you can tell, I'm fairly new to not only elastic beanstalk/aws but to rails as well, so I could just be doing something totally wrong. 正如你所知,我不仅对弹性beanstalk / aws而且对rails也是新手,所以我可能只是做了一些完全错误的事情。

Also, when I remove bcrypt references (which I'm sure will break something) in the gemfile.lock, it just throws the same error on a different gem later on (ffi). 此外,当我删除gemfile.lock中的bcrypt引用(我肯定会破坏某些东西)时,它只会在稍后的(ffi)上在不同的gem上抛出相同的错误。 I'm sure there are many gems that it will eventually throw the error on if I just manage to fix the issue one gem at a time. 我敢肯定有很多宝石,如果我只是设法一次修复一个宝石问题,它最终会抛出错误。

The error is actually caused by instance running out of memory while running make: 该错误实际上是由运行make时实例内存不足引起的:

Cannot allocate memory - /opt/rubies/ruby-2.1.2/bin/ruby extconf.rb  2>&1

More than likely you are running a micro instance--bump it up to a larger instance size and it should build reliably. 您运行微型实例的可能性很大 - 将其提升到更大的实例大小,并且应该可靠地构建。

Rohit is right though in his answer that missing system packages are often a cause of gems failing to install in Elastic Beanstalk. Rohit是正确的,但在他的回答中,缺少系统包通常是导致Gems无法在Elastic Beanstalk中安装的原因。

So there may be some dependencies on C libraries that are required for gem install bcrypt -v '3.1.7' . 因此,对于gem install bcrypt -v '3.1.7'所需的C库可能存在一些依赖性。 You can install native dependencies using yum and ebextensions. 您可以使用yum和ebextensions安装本机依赖项。

You can use ebextensions to install yum packages required for gem install to succeed. 您可以使用ebextensions来安装gem install所需的yum包以使其成功。 Create a file called .ebextensions/01-yum.config in your app source and put the following contents in it. 在您的应用程序源中创建一个名为.ebextensions/01-yum.config的文件,并在其中放入以下内容。

packages: 
  yum:
    <required-native-dependency>: []

This file is in YAML format so indentation is important. 此文件采用YAML格式,因此缩进很重要。

Read more about pacakges section of ebextensions here: 在这里阅读更多关于ebextensions的pacakges部分:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-packages http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-packages

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM