如何使用生态系统.json文件启动pm2 http Web界面? [英] How to start pm2 http web interface using the ecosystem.json file?

查看:268
本文介绍了如何使用生态系统.json文件启动pm2 http Web界面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用生态系统.json文件启动pm2 Web界面,但以下配置不起作用:

I am trying to start the pm2 web interface using the ecosystem.json file but the following configuration does not work:

{
"apps" : [{
"name"        : "web",
"script"      : "",
"args" : ["web"],
"env": {
   "NODE_ENV": "development",
   "PM2_API_IPADDR" : "localhost",
   "PM2_API_PORT" : "1234"
},
"env_production" : {
   "NODE_ENV": "production",
   "PM2_API_IPADDR" : "localhost",
   "PM2_API_PORT" : "1234"
},
"env_staging" : {
   "NODE_ENV" : "staging",
   "PM2_API_IPADDR" : "localhost",
   "PM2_API_PORT" : "1234",
   "TEST"     : true
}
}]
}

推荐答案

基于 https://github.com/Unitech/pm2/blob/master/lib/API/Extra.js#L436 ,我设法使它正常工作

Based on https://github.com/Unitech/pm2/blob/master/lib/API/Extra.js#L436, I managed to get this working

将其放置为生态系统文件中的最后一项,它将始终具有最高ID

Put it as the last item in your ecosystem file, and it will always have the highest id

确保脚本路径正确,这是MY系统上的默认路径,可能不在您的

Make sure that the script path is correct, it was the default on MY system, it might not be on your

我正在运行2.9.3,并且当前代码(3.5.0)相似,因此应该可以正常工作

I'm running 2.9.3, and the current code (3.5.0) is similar, so it SHOULD work

    {
        script : '/usr/local/lib/node_modules/pm2/lib/HttpInterface.js',
        name : 'pm2-http-interface',
        execMode : 'fork_mode',
        env : {
            PM2_WEB_PORT : 9615
        }
    }

这篇关于如何使用生态系统.json文件启动pm2 http Web界面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆