5

I am currently working on an node.js app that is deployed on Elastic Beanstalk. It has started to reference a private module that is hosted on github as a private repository. Locally if I put a reference to it in the dependency section of my package.json like the following it works fine. I can run nom install, it downloads the module and the app works without issue.

"ModuleName": "git+https://TOKEN:x-oauth-basic@github.com/OWNER/REPO_NAME.git"

However, when I try to deploy to Beanstalk it fails with the following error:

2014-04-04 00:14:09,188 [DEBUG] (1630 MainThread) [commandWrapper.py-60] [root commandWrapper main] Command result: {'status': 'FAILURE', 'results': [{'status': 'FAILURE', 'config_sets': ['Infra-EmbeddedPreBuild', 'Hook-PreAppDeploy', 'Infra-EmbeddedPostBuild'], 'returncode': 1, 'events': [{'msg': 'Failed to run npm install. Snapshot logs for more details.', 'timestamp': 1396570449, 'severity': 'ERROR'}, {'msg': 'Failed to run npm install. npm http GET https://registry.npmjs.org/express\nnpm ERR! not found: git\nnpm ERR! \nnpm ERR! Failed using git.\nnpm ERR! This is most likely not a problem with npm itself.\nnpm ERR! Please check if you have git installed and in your PATH.\n\nnpm ERR! System Linux 3.4.73-64.112.amzn1.x86_64\nnpm ERR! command "/opt/elasticbeanstalk/node-install/node-v0.10.26-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v0.10.26-linux-x64/bin/npm" "install"\nnpm ERR! cwd /tmp/deployment/appli', 'timestamp': 1396570449, 'severity': 'ERROR'}], 'msg': 'Error occurred during build: Command hooks failed\n'}], 'api_version': '1.0'}

From what I can tell by reading that it appears that git is not installed on the default linux AMI that Beanstalk uses. My question is what is the best way to handle this. Currently I'm considering the following two options:

  1. Either use an AMI that has git installed or force the installation somehow during boot.
  2. Create a build process that packages all my node_modules prior to deploying to Beanstalk.

Do these two options make sense or should I be considering another option? Is there a recommended way to handle this with Elastic Beanstalk or in the node ecosystem in general?

approxiblue
  • 6,982
  • 16
  • 51
  • 59
Ginny Dellinger
  • 105
  • 1
  • 4
  • I would go for option (2) – Hector Correa Apr 04 '14 at 14:43
  • I don't sure if Elastic Beanstalk don't have git installed. I guess the problem is the permission to access your private repository. Try to read this [http://stackoverflow.com/questions/13476138/setting-up-private-github-access-with-aws-elastic-beanstalk-and-ruby-container](http://stackoverflow.com/questions/13476138/setting-up-private-github-access-with-aws-elastic-beanstalk-and-ruby-container) – Scoup Apr 05 '14 at 15:24

1 Answers1

3

You can make sure that git is installed on the machine by adding a config file in the .ebextensions folder. See http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html

If you add a file called .ebextensions/packages.config which contains the following:

#extra yum packages
packages:
  yum:
    git: []

This will install git on the machine before installation of your application.