直到今天早上我才能部署我的laravel应用程序而没有任何问题。我没有用作曲家改变任何东西,并在我的.ebextensions文件夹中进行了以下设置
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
尝试部署时,我在实例日志中遇到以下错误
[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":[]}]}
和
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
如果我删除自我更新通话,则会收到此错误
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].
我遇到的任何事情我都试过没有成功。无论部署版本如何,它都会发生在我的每个实例(甚至是不同的项目)上。我可以在本地更新composer,如果我在其中进行手动操作,则可以在有问题的服务器上更新。我可以部署到今天早上好,我没有改变任何东西,所以我不知道它可能是什么。 我在运行PHP 5.5的64位Amazon Linux 2014.09 v1.0.9上运行
答案 0 :(得分:1)
这似乎是Composer本身的一个问题。
https://github.com/composer/composer/issues/4789
在1.0.0-alpha11
之后添加self-update
并添加
- namespace: aws:elasticbeanstalk:application:environment
option_name: HOME
value: /root
在option_settings
解决了这个问题。