在群集模式下在Elastic Beanstalk上运行pm2

时间:2021-11-03 23:18:28

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.

我一直在尝试在AWS Elastic Beanstalk的节点Web服务环境中运行pm2,但没有运气。我通过以下方式启动快速api:./ node_modules / .bin / pm2 start server.js -i 0但服务器永远不会退出Degraded状态。我可以在本地运行同样的命令就好了。我已经进入了aws实例并查看了日志,但我没有看到任何错误。如果我可以通过集群模式与eb成功运行pm2的人聊天,那将是一个很大的帮助。

Thanks!

1 个解决方案

#1


2  

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).

我已经在aws弹性beanstalk上成功部署了pm2,它有多种方法可以实现。您可以将安装命令添加到.elasticbeanstalk / config.yml文件以进行pm2全局安装,或者只需将pm2安装到您的应用程序中,并按照以下链接的说明(推荐方式)。

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) :

至于第一种方法,在config.yml文件中,只需添加以下行(上面的链接不需要这样):

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

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

您需要使用此方法手动编写应用程序的启动命令。

#1


2  

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).

我已经在aws弹性beanstalk上成功部署了pm2,它有多种方法可以实现。您可以将安装命令添加到.elasticbeanstalk / config.yml文件以进行pm2全局安装,或者只需将pm2安装到您的应用程序中,并按照以下链接的说明(推荐方式)。

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) :

至于第一种方法,在config.yml文件中,只需添加以下行(上面的链接不需要这样):

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

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

您需要使用此方法手动编写应用程序的启动命令。