Reputation: 51
I am running into an issue. I have deployed my nodejs websocket app to Amazon elastic beanstalk. I am trying to run app as daemon process, that's why I have globally installed pm2
using configfile in ebextension:
container_commands:
01_node_symlink:
command: "ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/node /bin/node"
02_npm_symlink:
command: "ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/npm /bin/npm"
03_pm2_install:
command: "if [ ! -e /bin/pm2 ]; then npm install pm2 -g; fi"
ignoreErrors: true
As elastic beanstalk start server automatically, to use pm2
I have written start command in my package.js
start:"pm2 start server.js -i 0 --name="hub""
But when elastic beanstalk uses this command to start server it goes in start-stop loop and all cpus is used. Thanks in advance
Upvotes: 5
Views: 1623
Reputation: 13286
That's because pm2 process exits just after it starts the server, so eb run it again. add " && pm2 logs" to the command to keep it on.
Upvotes: 5