Debugger not Working with Console with Ruby on Rails instance running on Docker container
Answered
Hi,
This is my second year using this product. But ever since I started using Docker to run my Rails server, I haven't been able to figure this out.
I need help setting up my debugger so it works with my Rails console. I have tried different approaches but can't seem to make it work. My debugger works perfectly fine with Specs or with my Server.
I basically end up using ByeBug due to this. Please point me in the right direction or documention solve this nagging issue once and for all.
Please sign in to leave a comment.
Hello,
We have a known issue for debugging consoles with docker and docker compose so could you please take a look at it and add your vote there.
ok, but has anyone been able to somehow make it work? Or is this a general thing; that is, the debugger doesn't work at all in Docker containers? If not, can you share any related articles, guides, threads, etc…
I found this article: https://www.jetbrains.com/help/ruby/remote-debugging-with-product.html#create_ruby_remote_debug
Does this apply to my case?
Debugger works if we speak about debugging Rails server or Ruby script, for example. Please check our tutorial about that:
https://www.jetbrains.com/help/ruby/using-docker-compose-as-a-remote-interpreter.html#debug_with_docker_compose
Yes, this works for me. I mean, if anyone has made it work for the rails console? I mean like executing any command on the rails console, and being able to set breakpoints as usual (like when debugging the server as in your tutorial link)?
SOLVED
After updating RubyMine to the latest version, and modifying the local path for my remote DSK, the debugger started working on my console. It's pretty neat! I had never used until now. It will be very handy in my daily work.
Hello Arturo,
That's interesting, thank you for sharing your solution. Using docker or docker compose interpreters doesn't require any editing for the paths of the added interpreter, and as far as I understood debugging Rails server and/or Ruby scripts worked for you.
May it's because I build my docker container from my local project. Gems seem to need to be in sync between my local app and the remote app in my container. WHen the path mappings don't match, I usually have issues.
Would it be possible to provide more detailed steps on how you build your docker container?
sure.
My setup is like this:
Env setup:
My RubyMine info:
debugger.new.tool.window.layout=true
ide.experimental.ui=true
Dockerfile
# docker-compose.yml
Steps I followed to fix:
I basically followed the usual procedure to set up a remote interpreter, like in this post https://www.jetbrains.com/help/ruby/using-docker-compose-as-a-remote-interpreter.html#configure_remote_interpreter
The main difference is that in step 4 of Configure Compose as a remote interpreter , “Select the added SDK in the Ruby SDK and Gems page and click OK.”, before hitting OK, I edited my “Path Mappings”, and instead of setting my Local Path to “/”, as I have always done, I used my complete local path to my project; e.g. “my_local_path/to_my_project/my_rails_app”. My remote path is just the usual “/app”.
That's how it works.
Thank you for the detailed answer, we'll check it.