node.js - AWS Elastic Beanstalk ebextension not executing shell script to use npm install -
i need install separate framework created inside node js application running on elastic beanstalk.
i have tried putting scripts inside main package.json file permission errors when installs.
so created config file , tried running npm install container_commands. didn't want run npm said command missing. tried adding correct environment path variables npm, work when done manually through ssh, gave same error couldn't find npm command.
so finally.
i created bash script through ebextension installs application , run script container_commands.
the script gets created correctly never runs. if ssh instances , execute manually sudo works. app deploys without erros never seems execute script, know because node_modules folders never created.
i'm not sure errors in logs , when tried didn't find useful.
here ebextension:
files: "/tmp/install_application.sh": mode: "000755" owner: root group: root content: | #!/bin/bash export path=$path:`ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin eval "cd /var/app/current/library/server && npm install --production" eval "cd /var/app/current && npm install --production" container_commands: 00-install-application: command: "sh /tmp/install_application.sh"
i managed find answer this. had few issues script.
- old scripts still in hooks folders previous attempts.
- i firing script before project had unzipped yet or firing script after project had deployed.
- i installing modules final destination /var/app/current being overwritten once deployed app installed.
here final script.
files: "/opt/elasticbeanstalk/hooks/appdeploy/enact/00-install-application.sh": mode: "000755" owner: root group: root content: | #!/bin/bash path=$path:`ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin cd "/tmp/deployment/application/library/server" npm install --production
Comments
Post a Comment