strongloop / strong-pm

deployer for node applications
http://strong-pm.io
Other
1k stars 71 forks source link

log when an app/service starts listening on a port #194

Closed rmg closed 9 years ago

rmg commented 9 years ago

Driver API contract gains the requirement to emit a 'listening' event whenever an instance starts listening on a new address/port. How this is tracked is up to the driver, but the event should emit the instanceId and an object containing address and port fields.

Connect to strongloop-internal/scrum-nodeops#507

sam-github commented 9 years ago

Look back at https://github.com/strongloop-internal/scrum-nodeops/issues/507#issuecomment-97599822

This PR literally satisfies @cgole's bug title "pm console output for multi-app does not say what port app has started on" (I changed the title), but it doesn't solve the problem. The console output isn't usually visible: it's completely discarded when using slc start is used, its tucked away in upstart/systemd logs on remote hosts when you deploy into production, etc. Its only visible when pm is run by hand, the least likely scenario.

Btw, wrt. my comment above, reading this PR reminds me of yet another possible solution:

All the listening events are already recorded in the mesh models, they are in the ServiceProcess.listeningSockets property: the status command already prints per-process information, but it isn't printing the listening sockets. It should.

This could even be done in-addition to listing the PORT in the env vars, since it shows what might be a common failure scenario: the app isn't listening on the port specified by process.env.PORT.