MicFin
MicFin

Reputation: 2511

Error on first git aws.push to elastic beanstalk

I am new to Elastic Beanstalk and am trying to launch a Rails 4 app. I have followed the guide here http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-reference-get-started.html but when I go to do

git aws.push

It tells me that my update had errors.

[Instance: i-a6482b8b Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed .

The ebs log is just jam packed with lots of confusing items I am not familiar with. It is hard to tell what to share but these two areas stood out

  1. Lots of No's here so that isn't a great sign. Also calls a bunch of python files which is confusing because I should be running 64bit Amazon Linux 2014.03 v1.0.4 running Ruby 2.0 (Passenger Standalone).

    14-09-22 05:31:28,375 [INFO] Running configSet Infra-WriteApplication2 2014-09-22 05:31:28,376 [INFO] Running config Infra-WriteApplication2 2014-09-22 05:31:28,376 [DEBUG] No packages specified 2014-09-22 05:31:28,376 [DEBUG] No groups specified 2014-09-22 05:31:28,377 [DEBUG] No users specified 2014-09-22 05:31:28,377 [DEBUG] No sources specified 2014-09-22 05:31:28,377 [DEBUG] Writing content to /opt/elasticbeanstalk/bin/download_source_bundle 2014-09-22 05:31:28,377 [DEBUG] Retrieving contents from https://s3.amazonaws.com/elasticbeanstalk-env-resources-us-east-1/eb_patching_resources/download_source_bundle.py 2014-09-22 05:31:28,624 [DEBUG] Setting mode for /opt/elasticbeanstalk/bin/download_source_bundle to 000750 2014-09-22 05:31:28,625 [DEBUG] Setting owner 0 and group 0 for /opt/elasticbeanstalk/bin/download_source_bundle 2014-09-22 05:31:28,625 [DEBUG] Running command 01downloadVersion 2014-09-22 05:31:28,626 [DEBUG] No test for command 01downloadVersion 2014-09-22 05:31:29,354 [INFO] Command 01downloadVersion succeeded 2014-09-22 05:31:29,355 [DEBUG] Command 01downloadVersion output: 2014-09-22 05:31:29,355 [DEBUG] Running command 02deleteVersionDownloadScriptFile 2014-09-22 05:31:29,356 [DEBUG] No test for command 02deleteVersionDownloadScriptFile 2014-09-22 05:31:29,370 [INFO] Command 02deleteVersionDownloadScriptFile succeeded 2014-09-22 05:31:29,371 [DEBUG] Command 02deleteVersionDownloadScriptFile output: 2014-09-22 05:31:29,371 [DEBUG] No services specified 2014-09-22 05:31:29,384 [INFO] Running configSet Infra-EmbeddedPreBuild 2014-09-22 05:31:29,388 [INFO] Running configSet Hook-PreAppDeploy 2014-09-22 05:31:29,389 [INFO] Running config Hook-PreAppDeploy 2014-09-22 05:31:29,389 [DEBUG] No packages specified 2014-09-22 05:31:29,389 [DEBUG] No groups specified 2014-09-22 05:31:29,389 [DEBUG] No users specified 2014-09-22 05:31:29,390 [DEBUG] No sources specified 2014-09-22 05:31:29,390 [DEBUG] No files specified 2014-09-22 05:31:29,390 [DEBUG] Running command hooks 2014-09-22 05:31:29,390 [DEBUG] No test for command hooks 2014-09-22 05:31:41,367 [ERROR] Command hooks (directoryHooksExecutor.py --path /opt/elasticbeanstalk/hooks/appdeploy/pre/) failed 2014-09-22 05:31:41,367 [DEBUG] Command hooks output: 2014-09-22 05:31:41,368 [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-09-22 05:31:41,369 [ERROR] Unhandled exception during build: Command hooks failed Traceback (most recent call last): File "/opt/aws/bin/cfn-init", line 122, in 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)

  2. This is another area that looked exceptionally bad. I have git installed and am not sure why it is asking about bundle...

    • bundle install Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. Fetching gem metadata from https://rubygems.org/........ You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git

    2014-09-22 05:31:41,280 [ERROR] (4868 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed with returncode 11

I apologize for the code snippets being odd, I just can't win today!

Does anyone have AWS/Elastic Beanstalk experience that can guide me in how to troubleshoot this?

Upvotes: 3

Views: 3813

Answers (1)

Rohit Banga
Rohit Banga

Reputation: 18926

Do you have git installed on your ec2 instance?

You can install it by using an ebextension. Create a file called .ebextensions/01-git.config. The file name should have a .config extension.

The contents of the file can be as follows:

packages:
  yum:
    git: []

This file is in YAML format so indentation is important. You can read more about packages section of ebextensions here. Commit this file and run git aws.push again. It will deploy a new application version to your environment and that will install git on your EC2 instances.

Most likely your Gemfile has sources as git urls. That is why bundler is trying to fetch using git. You can also consider using vendored gems with Elastic Beanstalk. Read more here.

Also regarding the python files, those are python scripts that Elastic Beanstalk runs to deploy the application version on your instances.

Upvotes: 7

Related Questions