2

I have a NodeJs app running on a docker container on a remote server. I can access the app on the browser. I'm also able to deploy to my app using PhpStorm and its remote server connection.

However, I tried to use the remote NodeJs debug tool of PhpStorm and it doesn't work. I always get connection refused.

I know the debug port is open because I check the docker containers and the 5858 is open. This port is also oppened on the host. And this is also the port I set for the debug.

package.json:

"scripts": {
    "start": "nodemon --debug=5858 index.js myApp"
 }

I don't know if PhpStorm is the best solution to debug this kind of app. So if someone has a better idea please let me know.

Thanks!

After further searching I found this great repository:

https://github.com/seelio/node-inspector-docker

It seems to me the easier way to make the app running and debug it.

2
  • It'd be helpful if you include docker ps with the container running and sudo lsof -i TCP:5858 on the host. (Just in case, I know you mentioned that you verified it, but the ports can be "open" on the container and not be forwarded correctly on the host) Also check any sort of iptables and such -- or if AppArmor or SELinux is in use, check to make sure they aren't blocking for whatever reason. Commented Jan 11, 2017 at 20:16
  • @NickBurke thanks for the answer. I just added a great repository I found. If you have better examples, please post them here. Commented Jan 12, 2017 at 15:57

2 Answers 2

0

Definitely node-inspector,

I had to do the same for an app in microservices and clusters/workers just in case you need it: clustered apps with node-inspector

Sign up to request clarification or add additional context in comments.

2 Comments

node-inspector doesn't work with the most recent versions of node. It changed somewhere between node 4 and node 6. But 6 has a built-in feature which provides the same interface as node-inspector (once you've found out what the debug URL is).
Thanks for the update. I had read about it but never tried, didnt know it comes as built-in
0

You can use intelij IDEA as IDE

It support running app directly from docker and allows you to debug apps easily.

once configured with your docker image its done. next time just click run and it will start quickly nodejs inside your docker and show logs etc all just like we do with local node instance

https://www.jetbrains.com/help/idea/2016.3/running-and-debugging-node-js.html#node_docker_run_debug

Its EAP and communitiy editions are always is free

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.