Как исправить ошибку в связке в AWS эластичный beanstalkd - PullRequest
0 голосов
/ 23 июня 2019

я - пользователь noob, упругий бобовый стебель AWS, это указано в моем приложении на локальной машине

  • ruby: 2.6.3p62
  • Пакет: 2.0.2
  • Рельсы: 5.2.3
  • Пума: 3.12.1
$eb create


2019-06-23 06:17:18    INFO    Created CloudWatch alarm named: awseb-e-cpfnjrtvdk-stack-AWSEBCloudwatchAlarmLow-GYT3H9Y4NMZV
2019-06-23 06:17:25    ERROR   [Instance: i-028a561a32ccd0ce4] Command failed on instance. Return code: 1 Output: (TRUNCATED)...:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
    from /opt/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:308:in `activate_bin_path'
    from /opt/rubies/ruby-2.6.3/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-06-23 06:17:25    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-06-23 06:18:27    ERROR   Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

, а затем я пытаюсь решить

# Go to your project root directory
$ mkdir .ebextensions
$ vim .ebextensions/bundler_install.config 

  files:
    "/tmp/45_nginx_https_rw.sh":
      owner: root
      group: root
      mode: "000644"
      content: |
        #! /bin/bash

        CONFIGURED=`grep -c "return 301 https" /opt/elasticbeanstalk/support/conf/webapp_healthd.conf`

        if [ $CONFIGURED = 0 ]
           then
             sed -i '/listen 80;/a \    if ($http_x_forwarded_proto = "http") { return 301 https://$host$request_uri; }\n' /opt/elasticbeanstalk/support/conf/webapp_healthd.conf
             logger -t nginx_rw "https rewrite rules added"
             exit 0
           else
             logger -t nginx_rw "https rewrite rules already set"
             exit 0
        fi

  container_commands:
    00_appdeploy_rewrite_hook:
     command: cp -v /tmp/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/appdeploy/enact
    01_configdeploy_rewrite_hook:
      command: cp -v /tmp/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact
    02_rewrite_hook_perms:
      command: chmod 755 /opt/elasticbeanstalk/hooks/appdeploy/enact/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact/45_nginx_https_rw.sh
    03_rewrite_hook_ownership:
      command: chown root:users /opt/elasticbeanstalk/hooks/appdeploy/enact/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact/45_nginx_https_rw.sh

, а затем я получаю ошибку

ERROR   The configuration file .ebextensions/bundler_install.config in application version app-d78c-190624_064301 contains invalid YAML or JSON. YAML exception: Invalid Yaml: while parsing a block mapping
 in "<reader>", line 1, column 1:
    files:
    ^
expected <block end>, but found BlockMappingStart
 in "<reader>", line 21, column 3:
      container_commands:
      ^
, JSON exception: Invalid JSON: Unexpected character (f) at position 0.. Update the configuration file.

Я ожидаю, что все события в порядке (INFO), но фактическая ошибка.как решить эту проблему в AWS beanstalk?

...