簡體   English   中英

將 Rails 6 應用程序部署到 Elastic Beanstalk 時出現 Bundler 錯誤

[英]Bundler error when deploying Rails 6 App to Elastic Beanstalk

在部署到 Heroku 和 AWS Elastic Beanstalk 時,我一直在努力解決眾所周知的bundler 2.0.x錯誤。 在嘗試了許多建議的補救措施后,例如更新 gems 和安裝 bundler 2.0.x 或bundler update --system 到目前為止,這些都沒有奏效。 我找到了一個在.ebextensions中創建文件的解決方案,如下所示:

files:

# Runs before \./10_bundle_install.sh`:`

"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :

mode: "000775"

owner: root

group: users

content: |

#!/usr/bin/env bash



EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)

EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)

# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: \bundler requires Ruby version >= 2.3.0``

. $EB_SCRIPT_DIR/use-app-ruby.sh



cd $EB_APP_STAGING_DIR

echo "Installing compatible bundler"

gem install bundler -v 2.1.0.pre.2

這是我在eb deploy staging-1上仍然遇到的錯誤:

Creating application version archive "app-7b50-191111_122622".
Uploading: [##################################################] 100% Done...
2019-11-11 17:28:21    INFO    Environment update is starting.      
2019-11-11 17:28:28    INFO    Deploying new version to instance(s).
2019-11-11 17:31:36    ERROR   [Instance: i-0ba40e32901557bee] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ystem, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.0.pre.2`
        from /opt/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
        from /opt/rubies/ruby-2.6.5/bin/bundle:23:in `<main>'. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-11-11 17:31:36    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-11-11 17:31:36    ERROR   Unsuccessful command execution on instance id(s) 'i-0ba40e32901557bee'. Aborting the operation.
2019-11-11 17:31:37    ERROR   Failed to deploy application.        

ERROR: ServiceError - Failed to deploy application.
[12:31:40] (master) tml_portal
// ♥ eb deploy staging-1
Creating application version archive "app-7b50-191111_123229".
Uploading: [##################################################] 100% Done...
2019-11-11 17:34:45    INFO    Environment update is starting.      
2019-11-11 17:34:53    INFO    Deploying new version to instance(s).
2019-11-11 17:37:47    ERROR   [Instance: i-0ba40e32901557bee] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ystem, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.0.pre.2`
        from /opt/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
        from /opt/rubies/ruby-2.6.5/bin/bundle:23:in `<main>'. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-11-11 17:37:47    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-11-11 17:37:47    ERROR   Unsuccessful command execution on instance id(s) 'i-0ba40e32901557bee'. Aborting the operation.
2019-11-11 17:37:48    ERROR   Failed to deploy application.        

ERROR: ServiceError - Failed to deploy application.

關於如何解決這個可怕的 Bundler 部署問題的任何想法?

它仍然缺少捆綁版本錯誤。 您可以嘗試以下操作:

#.ebextensions/bundler_update.config

commands:
  update_bundler:
    command: /opt/rubies/ruby-2.6.5/bin/gem install bundler -v 2.1.0.pre.2

Ruby 和 Bundler 版本應該與您的匹配。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM