简体   繁体   中英

Running pm2 on Elastic Beanstalk in cluster mode

I've been trying to run pm2 on AWS Elastic Beanstalk's node web service environment but without luck. I start up the express api via: ./node_modules/.bin/pm2 start server.js -i 0 but the server never comes out of a Degraded state. I can run this same command locally just fine. I have ssh'd into the aws instance and looked in the logs, but I don't see any errors. It would be a big help if I could chat with someone that has successfully run pm2 on eb via cluster mode.

Thanks!

I have successfully deploy pm2 on aws elastic beanstalk, it has more than one way to achieve. You may either add an installation command to the .elasticbeanstalk/config.yml file for pm2 global installation or simply install pm2 into your app and follow the instruction of the link below (recommended way).

https://gist.github.com/Unitech/4c8ea564aa8bf0a389c5

As for the first method, in your config.yml file, simply add the following line(the link above doesn't require this) :

container_commands:
    0_install_pm2:
        command: "npm install pm2 -g"

You need to manually handcode the start command for your app with this method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM