Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticBeanstalk, deployment error: Command hooks (directoryHooksExecutor.py --path /opt/elasticbeanstalk/hooks/appdeploy/pre/) failed

getting this error:

Command hooks (directoryHooksExecutor.py --path /opt/elasticbeanstalk/hooks/appdeploy/pre/) failed

after trying to deploy via git aws.push.

The deployment doesn't go through, the event that are thrown are:

2014-05-20 15:41:46 UTC-0700 ERROR [Instance: i-808b90df Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed . 2014-05-20 15:41:43 UTC-0700 ERROR Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed with returncode 1

This is the error log:

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

Any Ideas?

Thanks

like image 939
otrebla Avatar asked May 21 '14 00:05

otrebla


2 Answers

I published to a dev environment beanstalk that had a typo in the web.config so none of the web site would even run with a web.config corruption error. This corrupted the EC2 instance behind my beanstalk's 1 instance environment beyond repair. I corrected the typo but only got this error message when publishing.

Tried restarting the beanstalk. Tried restarting the EC2 instances behind the beanstalk. I even tried restoring with an older but working version using restore application versions under: beanstalk/environment name/application versions.

None of these worked.

The Solution:

In EC2 management I terminated the EC2 instance behind the beanstalk. The beanstalk then automatically recreates a new EC2 instance. Once that was completed, I was able to once again publish without this error.

like image 81
RandallTo Avatar answered Oct 22 '22 01:10

RandallTo


I ran into similar issue on the bundle_install.sh, use

$> eb logs

and check your /var/log/directory-hooks-executor.log, for me it fails on installing gem 'forem'.

like image 23
user3512640 Avatar answered Oct 22 '22 03:10

user3512640