简体   繁体   中英

aws elastic beanstalk composer suddenly fails

I've been able to deploy my laravel application without any issues until this morning. I've changed nothing with composer, and have the following settings in my .ebextensions folder

commands:
    001_update_composer:
        command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update

option_settings:
    - namespace: aws:elasticbeanstalk:application:environment
      option_name: COMPOSER_HOME
      value: /root

I get the following errors in the instance log when trying to deploy

[DEBUG] Action for aws-eb-command-handler output: {"status":"FAILURE","api_version":"1.0","truncated":"true","results":[{"status":"FAILURE","msg":"[CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/10_composer_install.sh] command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh\n++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir\n+ EB_APP_STAGING_DIR=/var/app/ondeck\n+ cd /var/app/ondeck\n+ '[' -f composer.json ']'\n+ export COMPOSER_HOME=/root\n+ COMPOSER_HOME=/root\n+ '[' -d vendor ']'\n++ /opt/elasticbeanstalk/bin/get-config optionsettings -n aws:elasticbeanstalk:container:php:phpini -o composer_options\n+ PHP_COMPOSER_OPTIONS=--no-dev\n+ echo 'Found composer.json file. Attempting to install vendors.'\nFound composer.json file. Attempting to install vendors.\n+ composer.phar install --no-ansi --no-interaction --no-dev\n\n                                                                                            \n  [RuntimeException]                                 ","returncode":1,"events":[]}]}

and

2016-01-19 03:40:10,193 [ERROR] Command 001_update_composer (export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update) failed
2016-01-19 03:40:10,194 [DEBUG] Command 001_update_composer output: 

  [RuntimeException]                                                                        
  The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly  


self-update [-r|--rollback] [--clean-backups] [--no-progress] [--] [<version>]


2016-01-19 03:40:10,194 [ERROR] Error encountered during build of prebuild_0_uo: Command 001_update_composer failed
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 511, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 247, in build
changes['commands'] = CommandTool().apply(self._config.commands)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/command_tool.py", line 113, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command 001_update_composer failed
2016-01-19 03:40:10,223 [ERROR] Unhandled exception during build: Command 001_update_composer failed
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 122, in <module>
worklog.build(detail.metadata, configSets)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 117, in build
Contractor(metadata).build(configSets, self)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 502, in build
self.run_config(config, worklog)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 511, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 247, in build
changes['commands'] = CommandTool().apply(self._config.commands)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/command_tool.py", line 113, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command 001_update_composer failed

If I remove the self-update call, I get this error

ERROR: [Instance: i-4a696c53] Command failed on instance. Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/10_composer_install.sh] command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh
++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir
+ EB_APP_STAGING_DIR=/var/app/ondeck
+ cd /var/app/ondeck
+ '[' -f composer.json ']'
+ export COMPOSER_HOME=/root
+ COMPOSER_HOME=/root
+ '[' -d vendor ']'
++ /opt/elasticbeanstalk/bin/get-config optionsettings -n aws:elasticbeanstalk:container:php:phpini -o composer_options
+ PHP_COMPOSER_OPTIONS=--no-dev
+ echo 'Found composer.json file. Attempting to install vendors.'
Found composer.json file. Attempting to install vendors.
+ composer.phar install --no-ansi --no-interaction --no-dev


  [RuntimeException]                                 .
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].

Anything I've come across I've tried with no success. It happens on every one of my instances (even a different project) no matter of the deploy version. I can update composer locally, and on the server in question if I ssh into it and do it manually. I could deploy just fine until this morning, and I haven't changed anything, so I am at a loss as to what it could be. I am running on 64bit Amazon Linux 2014.09 v1.0.9 running PHP 5.5

It seems to be an issue with Composer itself. https://github.com/composer/composer/issues/4789 By adding 1.0.0-alpha11 after self-update and adding - namespace: aws:elasticbeanstalk:application:environment option_name: HOME value: /root in option_settings resolved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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