简体   繁体   English

AWS Elastic Beanstalk-Rails部署问题

[英]AWS Elastic Beanstalk — Issue with rails deployment

So I have ruby 2.3.4 and bundler v 1.17.3 I tried to deploy it to elastic beanstalk using eb cli Then I got an error: 所以我有ruby 2.3.4和bundler v 1.17.3,我尝试使用eb cli将它部署到弹性beantalk中,然后出现一个错误:

[Instance: i-09d1c36b765b9a656] Command failed on instance. [实例:i-09d1c36b765b9a656]实例上的命令失败。 Return code: 18 Output: (TRUNCATED)...g: the running version of Bundler (1.16.2) is older than the version that created the lockfile (1.17.3). 返回代码:18输出:(TRUNCATED)... g:Bundler的运行版本(1.16.2)比创建锁文件(1.17.3)的版本旧。 We suggest you upgrade to the latest version of Bundler by running gem install bundler . 我们建议您通过运行gem install bundler升级到最新版本的Bundler。 Your Ruby version is 2.3.8, but your Gemfile specified 2.3.4. 您的Ruby版本是2.3.8,但是您的Gemfile指定了2.3.4。 Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. 挂钩/opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh失败。 For more detail, check /var/log/eb-activity.log using console or EB CLI. 有关更多详细信息,请使用控制台或EB CLI检查/var/log/eb-activity.log。

So I ran eb ssh: Installed rvm and ruby 2.3.4 and made it the default Installed bundler v 1.17.3 and made it the default 所以我运行了eb ssh:安装了rvm和ruby 2.3.4并将其设置为默认值安装了bundler v 1.17.3并将其设置为默认值

But when I ran eb deploy I get the same error. 但是,当我运行eb deploy时,会遇到相同的错误。 What am I doing wrong? 我究竟做错了什么?

Logs: 日志:

gem 'mocha', group: :test + '[' -d /var/app/ondeck/vendor/cache ']' + bundle install Don't run Bundler as root. gem'mocha',组::test +'['-d / var / app / ondeck / vendor / cache']'+捆绑安装不要以超级用户身份运行Bundler。 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. Bundler可以询问是否需要sudo,并且以root用户身份安装捆绑软件会对本机上的所有非root用户破坏该应用程序。
Warning: the running version of Bundler (1.16.2) is older than the version that created the lockfile (1.17.3). 警告:Bundler的运行版本(1.16.2)早于创建锁定文件(1.17.3)的版本。 We suggest you upgrade to the latest version of Bundler by running gem install bundler . 我们建议您通过运行gem install bundler升级到最新版本的Bundler。 Your Ruby version is 2.3.8, but your Gemfile specified 2.3.4 (Executor::NonZeroExitStatus) 您的Ruby版本是2.3.8,但是您的Gemfile指定了2.3.4(Executor :: NonZeroExitStatus)

[2019-07-12T16:20:25.830Z] INFO [9280] - [Application update app-260b-190712_161857@9/AppDeployStage0/AppDeployPreHook/10_bundle_install.sh] : Activity failed. [2019-07-12T16:20:25.830Z]信息[9280]-[应用程序更新app-260b-190712_161857@9/AppDeployStage0/AppDeployPreHook/10_bundle_install.sh]:活动失败。 [2019-07-12T16:20:25.830Z] INFO [9280] - [Application update app-260b-190712_161857@9/AppDeployStage0/AppDeployPreHook] : Activity failed. [2019-07-12T16:20:25.830Z]信息[9280]-[应用程序更新app-260b-190712_161857 @ 9 / AppDeployStage0 / AppDeployPreHook]:活动失败。 [2019-07-12T16:20:25.830Z] INFO [9280] - [Application update app-260b-190712_161857@9/AppDeployStage0] : Activity failed. [2019-07-12T16:20:25.830Z]信息[9280]-[应用程序更新app-260b-190712_161857 @ 9 / AppDeployStage0]:活动失败。 [2019-07-12T16:20:25.831Z] INFO [9280] - [Application update app-260b-190712_161857@9] : Completed activity. [2019-07-12T16:20:25.831Z]信息[9280]-[应用程序更新app-260b-190712_161857 @ 9]:已完成活动。 Result: Application update - Command CMD-AppDeploy failed 结果:应用程序更新-命令CMD-AppDeploy失败

I get this when starting fresh dev boxes because I always forget updating my init script. 启动新的开发工具箱时会得到此信息,因为我总是忘记更新自己的初始化脚本。

What you can do is to set up a hook to reinstall bundler, it's basically script that removes & installs it back 您可以做的是设置一个钩子以重新安装捆绑程序,基本上,该脚本可将其删除并重新安装。

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html

 #/opt/elasticbeanstalk/hooks/appdeploy/01_update_bundler.sh
 #!/bin/sh
 gem uninstall bundler
 gem install bundler -v 1.17.3 # or whatever version you want

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

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