I am trying to use foreman to start my rails app. Unfortunately I have difficulties connecting my IDE for debugging.
I read here about using
Debugger.wait_connection = true
Debugger.start_remote
to start a remote debugging session, but that does not really work out.
Question: Is there a way to debug a rails (3.2) app started by foreman? If so, what is the approach?
If you use several workers with full rails environment you could use the following initializer:
And in the foreman's logs you'll be able to find debugger's ports:
Now run debugger using:
One approach is to require debugger normally in your gemfile, and add
debugger
normally in your code as needed. When the server hits that line, it will stop, but foreman won't be verbose about it. In your foreman console you can blindly typeirb
, and only then will you see a prompt appear. Bad UX, right?Another (augmentative) approach is to tail your logs:
Hope this helps.