首页 > 解决方案 > 在 Amazon Linux 2 上部署 Rails 应用程序时构建失败

问题描述

我正在将现有的 Rails 应用程序从 Amazon Linux AMI 迁移到 Amazon Linux 2。我能够将 Rails linux 环境升级到 AL2,但部署失败。

我正在使用的部署过程是通过 CloudFormation 模板通过 CodePipeline

ApplicationCodePipeline:
  Type: AWS::CodePipeline::Pipeline
  DependsOn:
    - RailsApplication
    - RailsWebEnvironment
    - RailsWorkerEnvironment
  Properties:
    RoleArn: !ImportValue ApplicationRoleArn
    Stages:
      -
        Name: Source
        Actions:
          -
            Name: SourceAction
            ActionTypeId:
              Category: Source
              Owner: AWS
              Version: 1
              Provider: CodeCommit
            OutputArtifacts:
              - Name: SourceOutput
            Configuration:
              BranchName: !Ref RepositoryBranch
              RepositoryName: !GetAtt DeploymentRepository.Name
            RunOrder: 1
      -
        Name: Release
        Actions:
          -
            Name: WebReleaseAction
            ActionTypeId:
              Category: Deploy
              Owner: AWS
              Version: 1
              Provider: ElasticBeanstalk
            InputArtifacts:
              - Name: SourceOutput
            OutputArtifacts: []
            Configuration:
              ApplicationName: !Ref RailsApplication
              EnvironmentName: !Ref RailsWebEnvironment
            RunOrder: 1
          -
            Name: WorkerReleaseAction
            ActionTypeId:
              Category: Deploy
              Owner: AWS
              Version: 1
              Provider: ElasticBeanstalk
            InputArtifacts:
              - Name: SourceOutput
            OutputArtifacts: []
            Configuration:
              ApplicationName: !Ref RailsApplication
              EnvironmentName: !Ref RailsWorkerEnvironment
            RunOrder: 1
    ArtifactStore:
      Type: S3
      Location: !Ref DeploymentBucket

错误线索:

2021/07/22 14:06:16.376532 [INFO] Starting...
2021/07/22 14:06:16.376704 [INFO] Starting EBPlatform-PlatformEngine
2021/07/22 14:06:16.376799 [INFO] reading event message file
2021/07/22 14:06:16.376985 [INFO] no eb envtier info file found, skip loading env tier info.
2021/07/22 14:06:16.377119 [INFO] Engine received EB command userdata-exec
2021/07/22 14:06:16.393074 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:ACCOUNTID:stack/awseb-envID-stack/99999999-afaf-11ea-8b63 -r AWSEBAutoScalingGroup --region us-east-1
2021/07/22 14:06:16.697134 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:ACCOUNTID:stack/awseb-envID-stack/99999999-afaf-11ea-8b63 -r AWSEBBeanstalkMetadata --region us-east-1
2021/07/22 14:06:17.035090 [INFO] Unable to ping launch url, this is a scale-up instance.
2021/07/22 14:06:17.035168 [INFO] Engine command: (self-startup)
2021/07/22 14:06:17.035180 [INFO] Downloading EB Application...
2021/07/22 14:06:17.035185 [INFO] Region: us-east-1
2021/07/22 14:06:17.035189 [INFO] envID: envID
2021/07/22 14:06:17.035194 [INFO] envBucket: elasticbeanstalk-us-east-1-ACCOUNTID
2021/07/22 14:06:17.035199 [INFO] Using manifest file name from command request
2021/07/22 14:06:17.035212 [INFO] Unable to get version manifest file.
2021/07/22 14:06:17.035217 [INFO] Downloading latest manifest available.
2021/07/22 14:06:17.035221 [INFO] Download latest app version manifest
2021/07/22 14:06:17.035328 [INFO] resources/environments/envID/_runtime/versions/manifest
2021/07/22 14:06:17.095893 [INFO] latestManifest key *: resources/environments/envID/_runtime/versions/manifest_01234567891011
2021/07/22 14:06:17.096108 [INFO] Downloading: bucket: elasticbeanstalk-us-east-1-ACCOUNTID, object: /resources/environments/envID/_runtime/versions/manifest_01234567891011
2021/07/22 14:06:17.111209 [INFO] Download successful170bytes downloaded
2021/07/22 14:06:17.111370 [INFO] Trying to read and parse version manifest...
2021/07/22 14:06:17.114024 [INFO] Downloading: bucket: elasticbeanstalk-us-east-1-ACCOUNTID, object: /resources/environments/envID/_runtime/_versions/myApp/code-pipeline-PIPELINENO
2021/07/22 14:06:17.333707 [INFO] Download successful14681002bytes downloaded
2021/07/22 14:06:17.334068 [INFO] Executing instruction: SyncClock
2021/07/22 14:06:17.334092 [INFO] Starting SyncClock
2021/07/22 14:06:17.334107 [INFO] Running command /bin/sh -c /usr/bin/chronyc tracking
2021/07/22 14:06:17.338390 [INFO] Reference ID    : A9FEA97B (169.254.169.123)
Stratum         : 4
Ref time (UTC)  : Thu Jul 22 14:06:00 2021
System time     : 0.000000000 seconds fast of NTP time
Last offset     : -0.000000354 seconds
RMS offset      : 0.000003704 seconds
Frequency       : 3.598 ppm fast
Residual freq   : -0.000 ppm
Skew            : 0.056 ppm
Root delay      : 0.000534462 seconds
Root dispersion : 0.000283713 seconds
Update interval : 16.2 seconds
Leap status     : Normal

2021/07/22 14:06:17.338466 [INFO] Running command /bin/sh -c /usr/bin/chronyc -a makestep
2021/07/22 14:06:17.340858 [INFO] 200 OK
2021/07/22 14:06:17.340897 [INFO] Skipping Configure OS
2021/07/22 14:06:17.340905 [INFO] Skipping LockGUID
2021/07/22 14:06:17.340912 [INFO] Skipping GenerateEBBanner
2021/07/22 14:06:17.340921 [INFO] Skipping Install Process Manager
2021/07/22 14:06:17.340927 [INFO] Skipping install proxy
2021/07/22 14:06:17.340933 [INFO] Skipping installhealthd
2021/07/22 14:06:17.340940 [INFO] Skipping Install Log Streaming Manager
2021/07/22 14:06:17.340947 [INFO] Skipping install X-Ray
2021/07/22 14:06:17.340954 [INFO] Skipping install Third Party License
2021/07/22 14:06:17.340962 [INFO] Skipping installSqsd
2021/07/22 14:06:17.340969 [INFO] Skipping bootstraphealthd
2021/07/22 14:06:17.340975 [INFO] Skipping GetSetupProxyLog
2021/07/22 14:06:17.340981 [INFO] Skipping Install yum packages
2021/07/22 14:06:17.340987 [INFO] Skipping Install Bundles
2021/07/22 14:06:17.340996 [INFO] Skipping set up default ruby runtime
2021/07/22 14:06:17.341050 [INFO] Skipping MarkBaked
2021/07/22 14:06:17.341094 [INFO] Skipping TuneSystemSettings
2021/07/22 14:06:17.341101 [INFO] Executing instruction: GetSetupLogRotate
2021/07/22 14:06:17.341106 [INFO] Initialize LogRotate files and directories
2021/07/22 14:06:17.356375 [INFO] Skipping BootstrapCFNHup
2021/07/22 14:06:17.356403 [INFO] Executing instruction: StartCFNHup
2021/07/22 14:06:17.356409 [INFO] Start cfn-hup
2021/07/22 14:06:17.356431 [INFO] Running command /bin/sh -c systemctl is-active cfn-hup.service
2021/07/22 14:06:17.360352 [INFO] cfn-hup process is running, skip installation
2021/07/22 14:06:17.360380 [INFO] Skipping SetupPublishLogCronjob
2021/07/22 14:06:17.360391 [INFO] Skipping MarkBootstrapped
2021/07/22 14:06:17.360400 [INFO] Executing instruction: Save CFN Stack Info
2021/07/22 14:06:17.360562 [INFO] Starting SwitchCFNStack
2021/07/22 14:06:17.360577 [INFO] Executing instruction: stopSqsd
2021/07/22 14:06:17.360582 [INFO] This is a web server environment instance, skip stop sqsd daemon ...
2021/07/22 14:06:17.360592 [INFO] Executing instruction: PreBuildEbExtension
2021/07/22 14:06:17.360686 [INFO] Starting executing the config set Infra-EmbeddedPreBuild.
2021/07/22 14:06:17.360704 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:us-east-1:ACCOUNTID:stack/awseb-envID-stack/99999999-afaf-11ea-8b63 -r AWSEBAutoScalingGroup --region us-east-1 --configsets Infra-EmbeddedPreBuild
2021/07/22 14:06:18.870794 [INFO] Finished executing the config set Infra-EmbeddedPreBuild.
2021/07/22 14:06:18.870834 [INFO] Executing instruction: StageApplication
2021/07/22 14:06:18.920260 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2021/07/22 14:06:18.920304 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2021/07/22 14:06:19.216313 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2021/07/22 14:06:19.234264 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2021/07/22 14:06:19.234297 [WARN] skipping hooks scripts under /opt/elasticbeanstalk/hooks/
2021/07/22 14:06:19.234312 [INFO] The dir .platform/hooks/prebuild/ does not exist in the application. Skipping this step...
2021/07/22 14:06:19.234333 [INFO] Executing instruction: stage ruby application
2021/07/22 14:06:19.234362 [INFO] stage ruby application ....
2021/07/22 14:06:19.234423 [INFO] Running command /bin/sh -c bundle config set --local deployment true
2021/07/22 14:06:19.425824 [INFO] Running command /bin/sh -c bundle install
2021/07/22 14:06:53.363740 [INFO] Starting...
2021/07/22 14:06:53.363804 [INFO] Starting EBPlatform-PlatformEngine
2021/07/22 14:06:53.363823 [INFO] reading event message file
2021/07/22 14:06:53.363922 [INFO] no eb envtier info file found, skip loading env tier info.
2021/07/22 14:06:53.363984 [INFO] Engine received EB command cfn-hup-exec
2021/07/22 14:06:54.038858 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:ACCOUNTID:stack/awseb-envID-stack/99999999-afaf-11ea-8b63 -r AWSEBAutoScalingGroup --region us-east-1
2021/07/22 14:06:56.446708 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:ACCOUNTID:stack/awseb-envID-stack/99999999-afaf-11ea-8b63 -r AWSEBBeanstalkMetadata --region us-east-1
2021/07/22 14:06:58.707885 [INFO] checking whether command app-deploy is applicable to this instance...
2021/07/22 14:06:58.707905 [INFO] this command is applicable to the instance, thus instance should execute command
2021/07/22 14:06:58.707910 [INFO] Engine command: (app-deploy)
2021/07/22 14:06:58.707918 [INFO] Downloading EB Application...
2021/07/22 14:06:58.707922 [INFO] Region: us-east-1
2021/07/22 14:06:58.707926 [INFO] envID: envID
2021/07/22 14:06:58.707931 [INFO] envBucket: elasticbeanstalk-us-east-1-ACCOUNTID
2021/07/22 14:06:58.707935 [INFO] Using manifest file name from command request
2021/07/22 14:06:58.707944 [INFO] Manifest name is : manifest_01234567891011
2021/07/22 14:06:58.707948 [INFO] Download app version manifest
2021/07/22 14:06:58.708070 [INFO] Downloading: bucket: elasticbeanstalk-us-east-1-ACCOUNTID, object: /resources/environments/envID/_runtime/versions/manifest_01234567891011
2021/07/22 14:06:58.829380 [INFO] Download successful170bytes downloaded
2021/07/22 14:06:58.829544 [INFO] Trying to read and parse version manifest...
2021/07/22 14:06:58.832252 [INFO] Downloading: bucket: elasticbeanstalk-us-east-1-ACCOUNTID, object: /resources/environments/envID/_runtime/_versions/myApp/code-pipeline-PIPELINENO
2021/07/22 14:07:00.124444 [INFO] Download successful14681002bytes downloaded
2021/07/22 14:07:00.124750 [INFO] Executing instruction: ElectLeader
2021/07/22 14:07:00.124760 [INFO] Running leader election for instance i-INSTANCEID...
2021/07/22 14:07:00.124765 [INFO] Calling the cfn-elect-cmd-leader to elect the command leader.
2021/07/22 14:07:00.124783 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-elect-cmd-leader --stack arn:aws:cloudformation:us-east-1:ACCOUNTID:stack/awseb-envID-stack/99999999-afaf-11ea-8b63 --command-name ElasticBeanstalkCommand-AWSEBAutoScalingGroup --invocation-id 03f7bdee-d863-4e8c-8b2b-9dc158be9f2c --listener-id i-INSTANCEID --region us-east-1
2021/07/22 14:07:02.487229 [INFO] Instance is Leader.
2021/07/22 14:07:02.487296 [INFO] Executing instruction: stopSqsd
2021/07/22 14:07:02.487304 [INFO] This is a web server environment instance, skip stop sqsd daemon ...
2021/07/22 14:07:02.487309 [INFO] Executing instruction: PreBuildEbExtension
2021/07/22 14:07:02.487314 [INFO] Starting executing the config set Infra-EmbeddedPreBuild.
2021/07/22 14:07:02.487338 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:us-east-1:ACCOUNTID:stack/awseb-envID-stack/99999999-afaf-11ea-8b63 -r AWSEBAutoScalingGroup --region us-east-1 --configsets Infra-EmbeddedPreBuild
2021/07/22 14:07:04.860521 [INFO] Finished executing the config set Infra-EmbeddedPreBuild.
2021/07/22 14:07:04.860556 [INFO] Executing instruction: StageApplication
2021/07/22 14:07:06.309297 [ERROR] An error occurred during execution of command [app-deploy] - [StageApplication]. Stop running the command. Error: Recreating Dir failed with error: unlinkat /var/app/staging/vendor/bundle/ruby/2.7.0/gems: directory not empty 

更多线索:

2021/07/22 14:07:06.309461 [INFO] Executing cleanup logic
2021/07/22 14:07:06.309654 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1626962826,"severity":"ERROR"}]}]}
2021/07/22 14:07:06.309949 [INFO] Platform Engine finished execution on command: app-deploy
2021/07/22 14:07:56.257526 [INFO] Fetching gem metadata from https://rubygems.org/
Fetching gem metadata from https://rubygems.org/........
Fetching https://github.com/GuillaumeWrobel/gridhook.git
Fetching https://github.com/waynehoover/s3_direct_upload.git
Fetching rake 13.0.3
Installing rake 13.0.3
Fetching concurrent-ruby 1.1.8
Fetching minitest 5.14.4
Installing minitest 5.14.4
Installing concurrent-ruby 1.1.8
Fetching zeitwerk 2.4.2
Installing zeitwerk 2.4.2
Fetching builder 3.2.4
Installing builder 3.2.4
Fetching erubi 1.10.0
Installing erubi 1.10.0
Fetching mini_portile2 2.5.1
Installing mini_portile2 2.5.1
Fetching racc 1.5.2
Fetching crass 1.0.6
Installing crass 1.0.6
Installing racc 1.5.2 with native extensions
Fetching rack 2.2.3
Installing rack 2.2.3
Fetching nio4r 2.5.7
Installing nio4r 2.5.7 with native extensions
Fetching websocket-extensions 0.1.5
Installing websocket-extensions 0.1.5
Fetching marcel 1.0.1
Installing marcel 1.0.1
Fetching mini_mime 1.0.3
Installing mini_mime 1.0.3
Fetching aws-eventstream 1.1.1
Installing aws-eventstream 1.1.1
Fetching aws-partitions 1.453.0
Installing aws-partitions 1.453.0
Fetching jmespath 1.4.0
Installing jmespath 1.4.0
Using bundler 2.2.17
Fetching method_source 1.0.0
Installing method_source 1.0.0
Fetching thor 1.1.0
Installing thor 1.1.0
Fetching jsonapi-renderer 0.2.2
Installing jsonapi-renderer 0.2.2
Fetching public_suffix 4.0.6
Installing public_suffix 4.0.6
Fetching amazon_pay 2.6.1
Installing amazon_pay 2.6.1
Fetching execjs 2.7.0
Installing execjs 2.7.0
Fetching faraday-excon 1.1.0
Installing faraday-excon 1.1.0
Fetching faraday-net_http 1.0.1
Installing faraday-net_http 1.0.1
Fetching faraday-net_http_persistent 1.1.0
Installing faraday-net_http_persistent 1.1.0
Fetching multipart-post 2.1.1
Installing multipart-post 2.1.1
Fetching ruby2_keywords 0.0.4
Installing ruby2_keywords 0.0.4
Fetching multi_json 1.15.0
Installing multi_json 1.15.0
Fetching bcrypt 3.1.16
Installing bcrypt 3.1.16 with native extensions
Fetching msgpack 1.4.2
Installing msgpack 1.4.2 with native extensions
Fetching bootstrap-filestyle-rails 1.2.1
Installing bootstrap-filestyle-rails 1.2.1
Fetching ffi 1.15.0
Installing ffi 1.15.0 with native extensions
Fetching libxml-ruby 3.2.1
Installing libxml-ruby 3.2.1 with native extensions
Fetching browser 5.3.1
Installing browser 5.3.1
Fetching climate_control 0.2.0
Installing climate_control 0.2.0
Fetching coderay 1.1.3
Installing coderay 1.1.3
Fetching coffee-script-source 1.12.2
Installing coffee-script-source 1.12.2
Fetching country-select 1.2.1
Installing country-select 1.2.1
Fetching dalli 2.7.11
Installing dalli 2.7.11
Fetching declarative 0.0.20
Installing declarative 0.0.20
Fetching orm_adapter 0.5.0
Installing orm_adapter 0.5.0
Fetching hashie 4.1.0
Installing hashie 4.1.0
Fetching elasticsearch-rails 7.1.1
Installing elasticsearch-rails 7.1.1
Fetching excon 0.81.0
Installing excon 0.81.0
Fetching flutie 2.2.0
Installing flutie 2.2.0
Fetching formatador 0.2.5
Installing formatador 0.2.5
Fetching mime-types-data 3.2021.0225
Installing mime-types-data 3.2021.0225
Fetching ipaddress 0.8.3
Installing ipaddress 0.8.3
Fetching foundation_emails 2.2.1.0
Installing foundation_emails 2.2.1.0
Fetching geocoder 1.6.7
Installing geocoder 1.6.7
Fetching jwt 2.2.3
Installing jwt 2.2.3
Fetching memoist 0.16.2
Installing memoist 0.16.2
Fetching os 1.0.1
Installing os 1.0.1
Fetching httpclient 2.8.3
Installing httpclient 2.8.3
Fetching trailblazer-option 0.1.1
Installing trailblazer-option 0.1.1
Fetching uber 0.1.0
Fetching retriable 3.1.2
Installing uber 0.1.0
Installing retriable 3.1.2
Fetching rexml 3.2.5
Fetching webrick 1.7.0
Installing rexml 3.2.5
Installing webrick 1.7.0
Fetching sexp_processor 4.15.2
Installing sexp_processor 4.15.2
Fetching temple 0.8.2
Installing temple 0.8.2
Fetching tilt 2.0.10
Installing tilt 2.0.10
Fetching honeybadger 4.8.0
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Installing honeybadger 4.8.0
Fetching jquery-datetimepicker-rails 2.4.1.0
Installing jquery-datetimepicker-rails 2.4.1.0
Fetching rb-fsevent 0.10.4
Installing rb-fsevent 0.10.4
Fetching json 1.8.6
Fetching kaminari-core 1.2.1
Installing json 1.8.6 with native extensions
Installing kaminari-core 1.2.1
Fetching memcachier 0.0.2
Installing memcachier 0.0.2
Fetching newrelic_rpm 7.0.0
Installing newrelic_rpm 7.0.0
Fetching pg 1.2.3
Installing pg 1.2.3 with native extensions
Fetching puma 3.12.6
Installing puma 3.12.6 with native extensions
Fetching rails_serve_static_assets 0.0.5
Installing rails_serve_static_assets 0.0.5
Fetching rails_stdout_logging 0.0.5
Installing rails_stdout_logging 0.0.5
Fetching rdoc 4.3.0
Installing rdoc 4.3.0
Fetching ruby-ole 1.2.12.2
Installing ruby-ole 1.2.12.2
Fetching rubyzip 2.3.0
Installing rubyzip 2.3.0
Fetching slack-notifier 2.4.0
Installing slack-notifier 2.4.0
Fetching turbolinks-source 5.2.0
Installing turbolinks-source 5.2.0
Fetching sitemap_generator 6.1.2
Installing sitemap_generator 6.1.2
Fetching i18n 1.8.10
Installing i18n 1.8.10
Fetching tzinfo 2.0.4
Installing tzinfo 2.0.4
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Fetching warden 1.2.9
Installing warden 1.2.9
Fetching font_assets 0.1.14
Installing font_assets 0.1.14
Fetching rack-cors 1.1.1
Installing rack-cors 1.1.1
Fetching rack-maintenance 2.1.0
Installing rack-maintenance 2.1.0
Fetching nokogiri 1.11.3 (x86_64-linux)
Installing nokogiri 1.11.3 (x86_64-linux)
Fetching websocket-driver 0.7.3
Installing websocket-driver 0.7.3 with native extensions
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching aws-sigv4 1.2.3
Installing aws-sigv4 1.2.3
Fetching addressable 2.7.0
Installing addressable 2.7.0
Fetching autoprefixer-rails 10.2.4.0
Installing autoprefixer-rails 10.2.4.0
Fetching uglifier 4.2.0
Installing uglifier 4.2.0
Fetching faraday 1.4.1
Installing faraday 1.4.1
Fetching elasticsearch-api 7.12.0
Installing elasticsearch-api 7.12.0
Fetching bootsnap 1.4.9
Installing bootsnap 1.4.9 with native extensions
Fetching braintree 3.4.0
Installing braintree 3.4.0
Fetching terrapin 0.6.0
Installing terrapin 0.6.0
Fetching pry 0.14.1
Installing pry 0.14.1
Fetching coffee-script 2.4.1
Installing coffee-script 2.4.1
Fetching mime-types 3.3.1
Installing mime-types 3.3.1

2021/07/22 14:07:56.257600 [ERROR] An error occurred during execution of command [self-startup] - [stage ruby application]. Stop running the command. Error: install dependencies in Gemfile failed with error Command /bin/sh -c bundle install failed with error exit status 1. Stderr:Don't run Bundler as root. 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.

回溯

Errno::ENOENT: No such file or directory @ rb_sysopen - /var/app/staging/vendor/bundle/ruby/2.7.0/cache/memoist-0.16.2.gem
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:1414:in `initialize'
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:1414:in `open'
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:1414:in `copy_file'
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:511:in `copy_file'
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:430:in `block in cp'
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:1589:in `block in fu_each_src_dest'
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:1605:in `fu_each_src_dest0'
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:1587:in `fu_each_src_dest'
  /opt/rubies/ruby-2.7.3/lib/ruby/2.7.0/fileutils.rb:429:in `cp'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/package.rb:207:in `copy_to'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/rubygems/installer.rb:932:in `write_cache_file'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/rubygems_gem_installer.rb:34:in `install'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/source/rubygems.rb:176:in `install'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/installer/gem_installer.rb:67:in `install'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/installer/gem_installer.rb:18:in `install_from_spec'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/installer/parallel_installer.rb:186:in `do_install'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/worker.rb:62:in `apply_func'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/worker.rb:57:in `block in process_queue'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/worker.rb:54:in `loop'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/worker.rb:54:in `process_queue'
  /opt/rubies/ruby-2.7.3/lib/ruby/site_ruby/2.7.0/bundler/worker.rb:88:in `block (2 levels) in create_threads'

环境

Bundler       2.2.17
  Platforms   ruby, x86_64-linux
Ruby          2.7.3p183 (2021-04-05 revision 6847ee089d7655b2a0eea4fee3133aeacd4cc7cc) [x86_64-linux]
  Full Path   /opt/rubies/ruby-2.7.3/bin/ruby
  Config Dir  /opt/rubies/ruby-2.7.3/etc
RubyGems      3.2.17
  Gem Home    /var/app/staging/vendor/bundle/ruby/2.7.0
  Gem Path    /var/app/staging/vendor/bundle/ruby/2.7.0
  User Home   /root
  User Path   /root/.local/share/gem/ruby/2.7.0
  Bin Dir     /var/app/staging/vendor/bundle/ruby/2.7.0/bin
OpenSSL       
  Compiled    OpenSSL 1.0.2k  26 Jan 2017
  Loaded      OpenSSL 1.0.2k-fips  26 Jan 2017
  Cert File   /etc/pki/tls/cert.pem
  Cert Dir    /etc/pki/tls/certs
Tools         
  Git         2.23.4
  RVM         not installed
  rbenv       rbenv 1.1.2
  chruby      not installed

Bundler 构建元数据

Built At          2021-05-05
Git SHA           69xwq9f45w
Released Version  true

捆绑器设置

deployment
  Set for your local app (/var/app/staging/.bundle/config): true
path
  Set for your local app (/var/app/staging/.bundle/config): "vendor/bundle"
without
  Set for your local app (/var/app/staging/.bundle/config): [:test, :development]
  Set via BUNDLE_WITHOUT: [:test, :development]

Rubygems@github 上的问题链接:https ://github.com/rubygems/rubygems/issues/4777

[更新 07/29]

通过和通过服务应用一些配置后.ebextensionsProcfile.platform现在得到:

2021/07/29 13:04:20.356839 [ERROR] An error occurred during execution of command [app-deploy] - [rake tasks]. Stop running the command. Error: running rake task db:migrate failed with error command bundle exec rake db:migrate failed with error Command /bin/su webapp -c bundle exec rake db:migrate failed with error exit status 1. Stderr:/var/app/staging/vendor/bundle/ruby/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/var/app/staging/vendor/bundle/ruby/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
rake aborted!
ActiveRecord::ConnectionNotEstablished: server common name does not match host name

标签: ruby-on-railsamazon-web-servicesbundleramazon-linux-2

解决方案


推荐阅读