Pm2 not starting server on elastic beanstalk

I have a problem. I deployed the nodejs websocket app for Amazon elastic beanstalk. I am trying to run the application as a daemon process, so I installed globally pm2using 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 

How to automatically start the beanstalk automatic installation server, use pm2I wrote a start command in my .js package

start:"pm2 start server.js -i 0 --name="hub""

But when the elastic beanstalk uses this command to start the server, it goes into the start-stop cycle and the whole cpus is used. thanks in advance

+4
source share
1 answer

, pm2- , eb . "& & pm2 logs" , .

0

All Articles