ElasticBeanstalk,部署错误:命令挂钩(directoryHooksExecutor.py --path / opt / elasticbeanstalk / hooks / appdeploy / pre /)失败

时间:2014-05-21 00:08:01

标签: amazon-web-services deployment amazon-elastic-beanstalk

收到此错误:

Command hooks (directoryHooksExecutor.py --path /opt/elasticbeanstalk/hooks/appdeploy/pre/) failed
尝试通过git aws.push进行部署后

部署未完成,抛出的事件是:

  

2014-05-20 15:41:46 UTC-0700 ERROR [实例:i-808b90df模块:   AWSEBAutoScalingGroup ConfigSet:null]实例上的命令失败。   返回码:1输出:构建期间发生错误:命令挂钩   失败了。 2014-05-20 15:41:43 UTC-0700错误脚本   /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh失败   带有返回码1

这是错误日志:

2014-05-20 22:41:43,767 [ERROR] Command hooks (directoryHooksExecutor.py --path /opt/elasticbeanstalk/hooks/appdeploy/pre/) failed
2014-05-20 22:41:43,768 [DEBUG] Command hooks output: 
2014-05-20 22:41:43,768 [ERROR] Error encountered during build of Hook-PreAppDeploy: Command hooks 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 hooks failed
2014-05-20 22:41:43,795 [ERROR] Unhandled exception during build: Command hooks 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 hooks failed
2014-05-20 23:35:04,652 [DEBUG] CloudFormation client initialized with endpoint https://cloudformation.us-west-1.amazonaws.com
2014-05-20 23:35:04,653 [DEBUG] Describing resource AWSEBAutoScalingGroup in stack arn:aws:cloudformation:us-west-1:040951787496:stack/awseb-e-yz93miu6ma-stack/1bd7f720-da3f-11e3-a5f1-50fa003f9896

任何想法?

由于

6 个答案:

答案 0 :(得分:11)

我在bundle_install.sh上遇到了类似的问题,请使用

$> eb logs

并检查你的/var/log/directory-hooks-executor.log,对我来说,安装宝石'forem'失败了。

答案 1 :(得分:2)

我向开发环境发布了在web.config中有错字的beantalk,因此没有一个网站甚至会在出现web.config损坏错误的情况下运行。这损坏了我的beantalk的1实例环境背后的EC2实例,无法修复。我更正了错字,但在发布时仅收到此错误消息。

尝试重新启动beantalk。 尝试重新启动位于beantalk后面的EC2实例。 我什至尝试使用以下版本的还原应用程序版本来还原较旧但可以正常工作的版本:beanstalk /环境名称/应用程序版本。

这些都不起作用。

解决方案:

在EC2管理中,我终止了beantalk后面的EC2实例。然后,beanstalk自动重新创建一个新的EC2实例。一旦完成,我就可以再次发布而不会出现此错误。

答案 2 :(得分:1)

我遇到了类似的错误:/opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh failed with returncode 255原来它是作曲家的罪魁祸首。

/var/log/directory-hooks-executor.log中的日志:

2015-01-19 15:13:33,537 [INFO] (29969 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Executing script: /opt/elasticbeanstalk/hooks/appdeploy/    pre/10_composer_install.sh
+ '[' -f composer.json ']'
+ 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 --prefer-dist
Loading composer repositories with package information
PHP Fatal error:  Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///opt/elasticbeanstalk/support/composer.phar/    vendor/symfony/console/Symfony/Component/Console/Application.php:975
#1 phar:///opt/elasticbeanstalk/support/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(975): proc_open('stty -a | grep ...', Array, NULL, NULL,     NULL, Array)
#2 phar:///opt/elasticbeanstalk/support/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(853): Symfony\Component\Console\Application->    getSttyColumns()
#3 phar:///opt/elasticbeanstalk/support/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(818): Symfony\Component\Console\Application->    getTerminalDimensions()
#4 phar:///opt/elasticbeanstalk/support/composer.phar/vendor/symfony/console/Symfony/Component/Console/Applicat in phar:///opt/elasticbeanstalk/support/composer.phar/vendor/    symfony/console/Symfony/Component/Console/Application.php on line 975
Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///opt/elasticbeanstalk/support/composer.phar/vendor/    symfony/console/Symfony/Component/Console/Application.php:975
#1 phar:///opt/elasticbeanstalk/support/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(975): proc_open('stty -a | grep ...', Array, NULL, NULL,     NULL, Array)
#2 phar:///opt/elasticbeanstalk/support/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(853): Symfony\Component\Console\Application->    getSttyColumns()
#3 phar:///opt/elasticbeanstalk/support/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(818): Symfony\Component\Console\Application->    getTerminalDimensions()
#4 phar:///opt/elasticbeanstalk/support/composer.phar/vendor/symfony/console/Symfony/Component/Console/Applicat in phar:///opt/elasticbeanstalk/support/composer.phar/vendor/    symfony/console/Symfony/Component/Console/Application.php on line 975
2015-01-19 15:20:06,267 [ERROR] (29969 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/    pre/10_composer_install.sh failed with returncode 255

根据这个github issue,解决这个问题的方法是增加php.ini中的memory_limit

答案 3 :(得分:1)

我刚刚解决了类似的错误。似乎Elastic Beanstalk无法应对其中一个实例上的错误状态,并且根本无法部署到它上面,导致EB环境普遍不稳定。

我通过将实例数减少到1并重新部署来解决它。这只保留了一个很好的实例,杀死了有问题的实例,并解决了这个问题。

答案 4 :(得分:0)

我也面临类似的问题,即

  

挂钩/opt/elasticbeanstalk/hooks/appdeploy/pre/03build.sh失败。有关更多详细信息,请使用控制台或EB CLI检查/var/log/eb-activity.log

我建议从弹性beantalk的“日志”部分下载并彻底检查日志。在该日志中的某些位置,您会找到导致错误的原因。

答案 5 :(得分:0)

对我来说,它正在使用

services.AddHttpsRedirection(o => o.HttpsPort = 443);

在 .net core 5 应用程序的 Startup.cs 中。

基本上,您不能要求 Elastic Beanstalk 在您的应用程序中执行 HTTP -> HTTPS 重定向。您必须转到 EC2 仪表板并为您的 Elastic Beanstalk 应用程序找到负载均衡器。然后编辑 HTTP 侦听器的规则,不要忘记指定 HTTPS 端口。