How to start pm2 http web interface using the ecosystem.json file?

瘦欲@ 提交于 2019-12-12 06:30:43

问题


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
}
}]
}

回答1:


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

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

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

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
        }
    }



回答2:


not sure, but you can try to specify interpreter. It should be your PM2 (check it with whereis).

Try smth like { "apps": [{ "name": "web", "script": "", "interpreter": "/usr/local/bin/pm2", "args": "web" }] }

Please note - i didnot checked it at all, it just suggestion



来源:https://stackoverflow.com/questions/42044615/how-to-start-pm2-http-web-interface-using-the-ecosystem-json-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!