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:[email protected]/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:
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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With