[英]aws elastic beanstalk composer suddenly fails
直到今天早上,我已經能夠部署我的laravel應用程序而沒有任何問題。 我沒有使用composer進行任何更改,並且在.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,也可以在有問題的服務器上更新ssh並手動進行更新。 我可以部署到今天早上為止,而且我什么都沒做,所以我對可能的情況不知所措。 我在運行PHP 5.5的64位Amazon Linux 2014.09 v1.0.9上運行
這似乎與Composer本身有關。 https://github.com/composer/composer/issues/4789在self-update
后添加1.0.0-alpha11
並添加- namespace: aws:elasticbeanstalk:application:environment option_name: HOME value: /root
在option_settings
解決了此問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.