{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/8225d7ca5e83a3f9f0bb89a61d5df72c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"8225d7ca5e83a3f9f0bb89a61d5df72c","url":"https://api.github.com/users/dominictarr","login":"dominictarr","id":259374},"milestone":null,"assignee":null,"labels":[],"updated_at":"2011-10-29T09:04:00Z","closed_at":null,"comments":4,"url":"https://api.github.com/repos/nodejitsu/haibu-carapace/issues/16","body":"figured out a waaaay simpler method to discover the port an app has started on\r\n\r\n\r\n``` bash\r\nlsof -a -p $PID -i TCP\r\n\r\nCOMMAND   PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME\r\nnode    19423 dominic    5u  IPv4 244275      0t0  TCP *:8000 (LISTEN)\r\n```\r\n\r\nno need for complicated monkey patching or IPC.\r\n","html_url":"https://github.com/nodejitsu/haibu-carapace/issues/16","title":"detecting ports the easy way","number":16,"id":2085419,"created_at":"2011-10-29T01:54:30Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/60b9cc1b90ebe435542919ce877c97d7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"60b9cc1b90ebe435542919ce877c97d7","url":"https://api.github.com/users/stolsma","login":"stolsma","id":474182},"updated_at":"2011-10-29T09:04:00Z","url":"https://api.github.com/repos/nodejitsu/haibu-carapace/issues/comments/2564102","body":"A problem is if multiple (different) applications use the same port. Now this is handled by carapace by giving a next available port. if this is not being done then all apps need to detect that the port is not available and choose another port. I don't know if it is reasonable to request that from users/app developers because lots of devs won't be developing their apps specifically for a `haibu` implementation but users of that app don't know that (and probably they also don't know how to change the code correctly)...\r\n\r\nI think the correct implementation needs 2 solutions:\r\n\r\n * Preferred `port` and `addr` configuration (also for multiple ports/addr!!) in the app startup configuration given to haibu. The `addr` info is already there (domains/subdomains) only a smart way of adding ports and combining that to the request from carapace needs to be invented... (maybe also the port and addr the application will give can be used to return the correct port/addr)\r\n * A implementation of changing the requested `port` and `addr` by requesting the controlling haibu process `port` and `addr`. Haibu will then return a empty `port` and if needed an `addr` by using the data from the previous point..\r\n\r\nThese are just my ideas... ;-)\r\n","id":2564102,"created_at":"2011-10-29T09:04:00Z"}}