Thanks for this helpful guide. I get that you're covering Open-source options here, but another option for getting code-level debug data out of a containerized Node.js app is Rookout.com. It has some interesting advantages over a traditional debugger - it's always on, even in production, and it doesn't stop the app so you can create 'breakpoints' that don't actually break, all without restarting or redeploying. It also works at scale - you don't have to attach it to a single instance in a single container, it can debug across a whole Swarm or Cluster all at once.
On the other hand, it doesn't allow variable forcing or logic forcing, which means it's more limited than a true debugger. Of course, this has some advantages too (safe use on live systems etc).
Have you encountered Rookout before?
You can also start the inspector if the process is already running with:
kill -SIGUSR1 $pid
Where $pid is the process identifier of the program you want to debug.
Your tutorial is great. Why did you add "/usr/src/app/node_modules" in volumes. What is the purpose of it? because "/usr/src/app" contain every thing that we need.
Thank you. In you local machine in app folder you don't have node modules, so when you use mount your folder will override everything in /usr/src/app. The line you mentioned, sort of preventing overriding of node modules installed during the image build process.
You can do the same by adding node_modules to a .dockerignore file. 👍
No. dockerignore works only for the process of copying file during the build of the image and has nothing to do with mount.
Hi done it all and it dont wanna work
Impressive, always wanted to "grow up" and stop using console.dir() while developing nodejs apps :)
It's also much faster to debug functionality with debugger rather than using console.log or console.dir
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.