node.js - How can I run an npm script for an AWS Elastic Beanstalk Deployment? -
my package.json
has:
"scripts": { "start": "node_modules/.bin/coffee server.coffee", "test": "node_env=test node test/runner.js", "coverage": "node_env=test coverage=1 node test/runner.js -r html-cov test/ > ./test/coverage.html", "testw": "fswatch -o test src | xargs -n1 -i{} sh -c 'coffeelint src server.coffee ; npm test'", "db:drop": "node scripts/drop-tables.js", "encryptconfig": "node_modules/.bin/coffee config/encrypt.coffee", "decryptconfig": "node_modules/.bin/coffee config/decrypt.coffee", "postinstall": "npm run decryptconfig" },
when deploy elastic beanstalk, i'd run postinstall
, apparently doesn't that. okay, no problem.
i created file called .ebextensions/00.decrypt.config
has:
commands: 00-add-home-variable: command: sed -i 's/function error_exit/export home=\/root\n\nfunction error_exit/' /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh container_commands: 02-decrypt-config: command: $node_home/bin/npm run decryptconfig
however doesn't seem run either. doing incorrectly?
a few suggestions:
- try enclose commands in quotes, that's requirement
- also, not sure if $node_home working - run simple test echo $node_home > /tmp/test.txt?