Сбой AWS Elastic Beanstalk с проверкой работоспособности мерзавца - PullRequest
0 голосов
/ 04 марта 2019

При развертывании сборка завершается сбоем из-за того, что git не установлен.Но я включил скрипт, в котором есть git.Я не понимаю, почему все еще жалуется, что git недоступен.Я использую Ubuntu 64 / ruby ​​2.4.5 / rails 5.2 .Я пробовал оба решения, которые были размещены в stackoverflow, но ruby.config .ebextension не работает, несмотря на добавляемые пакеты.Как я могу обойти эту ошибку для Elastic Beanstalk?Я считаю, что это единственная проблема с моим процессом развертывания.

nginx.config

files:
  /etc/nginx/conf.d/proxy.conf:
    content: |
      client_max_body_size 500M;
      server_names_hash_bucket_size 128;

      upstream backend {
        server unix:///var/run/puma/my_app.sock;
      }

      server {
        listen 80;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        server_name env1.appgreat.us-east-2.elasticbeanstalk.com;

        large_client_header_buffers 8 32k;

        location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_set_header X-NginX-Proxy true;

          proxy_buffers 8 32k;
          proxy_buffer_size 64k;

          proxy_pass http://backend;
          proxy_redirect off;

          location /assets {
            root /var/app/current/public;
          }

          # enables WS support
          location /cable {
            proxy_pass http://backend;
            proxy_http_version 1.1;
            proxy_set_header Upgrade "websocket";
            proxy_set_header Connection "Upgrade";
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          }
        }
      }


container_commands:
  01restart_nginx:
    command: "service nginx restart"

ruby.config

packages:
yum:
    git: []
    patch: []
commands:
    01_bundlerfix_command:
        test: 'test ! -f /opt/elasticbeanstalk/containerfiles/.post-provisioning-complete'
        command: 'gem install rubygems-update'
        leader_only: false
    02_update_rubygems:
        test: 'test ! -f /opt/elasticbeanstalk/containerfiles/.post-provisioning-complete'
        command: '$(which update_rubygems)'
        leader_only: false
    add_bundle_exec:
        test: 'test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete'
        cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
        command: 'perl -pi -e ''s/((?<!bundle exec )rake)/bundle exec $1/g'' 11_asset_compilation.sh 12_db_migration.sh'
    add_deployment_flag:
        test: 'test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete'
        cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
        command: 'perl -pi -e ''s/(bundle install(?! --deployment))/$1 --deployment/'' 10_bundle_install.sh'
    make_vendor_bundle_dir:
        test: 'test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete'
        command: 'mkdir -p /var/app/support/vendor_bundle'
    set_vendor_bundle_var:
        test: 'test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete'
        cwd: /opt/elasticbeanstalk/support
        command: 'sed -i ''12iexport EB_CONFIG_APP_VENDOR_BUNDLE=$EB_CONFIG_APP_SUPPORT/vendor_bundle'' envvars'
    symlink_vendor_bundle:
        test: 'test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete'
        cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
        command: 'sed -i ''s/\(^cd $EB_CONFIG_APP_ONDECK\)/\1\nln -s $EB_CONFIG_APP_VENDOR_BUNDLE .\/vendor\/bundle/'' 10_bundle_install.sh'
    z_write_post_provisioning_complete_file:
        cwd: /opt/elasticbeanstalk/support
        command: 'touch .post-provisioning-complete'

Ошибка EB

2019-03-03 23:51:35    INFO    Created Auto Scaling group policy named: arn:aws:autoscaling:us-east-1:755687783:scalingPolicy:RRRRR-RRRR-RRRR-RRRR-6e6RGEGEGEGE:autoScalingGroupName/awseb-e-dndu3j6zku-stack-AWSEBAutoScalingGroup-17R6R5CYU73T1:policyName/awseb-e-dnRGEGEGEGEku-stack-AWSEBAutoScalingScaleDownPolicy-BRGEGEGEGE
2019-03-03 23:51:50    INFO    Created CloudWatch alarm named: awseb-e-dndGEGEGRGEGu-stack-AWSEBCloudwatchAlarmHigh-FPJ6EGEGEGEGEG
2019-03-03 23:51:50    INFO    Created CloudWatch alarm named: awseb-e-dnEGEGEu-stack-AWSEBCloudwatchAlarmLow-BeGGEGE2D4
2019-03-03 23:51:57    ERROR   [Instance: i-032fbeaeergegeg14] Command failed on instance. Return code: 11 Output: (TRUNCATED)...dle as root will break this application for all non-root
users on this machine. You need to install git to be able to use gems from git repositories. For help
installing git, please refer to GitHub's tutorial at
https://help.github.com/articles/set-up-git. 
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-03-03 23:51:57    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-03-03 23:53:00    ERROR   Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
...