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