Interactive console when using the `Ruby Remote Debug` configuration

Answered

Hey guys,

I have setup a `Ruby Remote Debug` configuration successfully and it points to a docker container. The breakpoints are respected, but I am unable to use the interactive console: It is just not there as a feature? FYI, local debug works just fine.

Is this by design? I am attaching a screenshot:


Thanks!

-- Petros

 

5 comments
Comment actions Permalink

Hello Petros,

could you please specify what you're debugging? In addition, have you tried running the corresponding run configuration in debug mode (not Ruby Remote Debug) or that's not an option?

0
Comment actions Permalink

Hi Olga,

Thank you for your prompt reply!

I will split my answer in 2 parts:

1. Debug using `Ruby remote Debug` configuration

I am not quite sure if I understand correctly the `what` question: I have dockerized a Rails application and I run it through a `docker-compose.yml` configuration.

This configuration looks like this (I have omitted sensitive and not relevant information):

version: '2.1'
services:
web
:
build: .
command: sh scripts/start-dev.sh
volumes:
- my-app-web-sync:/app:nocopy
- my-app-bundle-sync:/bundle:nocopy
- ./keys:/root/.ssh/
expose:
- "26168"
environment:
DB_USER: dbusername
DB_PASSWORD: dbpassword
DB_HOST: db
RAILS_ENV: staging
DEBUG_MODE: on
ports:
- "7000:7000"
- "1234:1234"
tty: true
stdin_open: true
networks:
- elk-net

The `start-dev.sh` file looks like this:

#!/bin/sh
bundle check || bundle install

until PGPASSWORD=nopass psql -h "db" -U "dbusername" -d "my-app-db" -c '\q'; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done

>&2 echo "Postgres is up - executing command"

if [ -z "${DEBUG_MODE}" ]; then
rm -rf tmp/pids/* && bundle exec rails server --port 7000 --binding 0.0.0.0 -e staging
else
rm -rf tmp/pids/* && bundle exec rdebug-ide --key-value --evaluation-timeout 10 --evaluation-control --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --host 0.0.0.0 --port 1234 --dispatcher-port 26168 -- bin/rails server -b 0.0.0.0 -p 7000 -e staging
fi

Based on the env variable `DEBUG_MODE`, when I `docker-compose up` the container will execute the `rdebug-ide` command which allows me to create a `Ruby Remote Debug` configuration in RubyMine, pointing to the container:

This configuration allows me only to `debug`, not run:

When I press the `debug` button here, RubyMine connects to the `rdebug-ide` process in the container and this allows me to set breakpoints which when reached, RubyMine will popup in the foreground (see the attached image I sent in my original question).

However, as you can also see in that image, there is no `interactive console` tab and this is why I posted this question in the first place

2. Debug by creating a local configuration which uses the ruby SDK of the `docker-compose` web service

I have tried the approach above by adding a remote SDK, pointing to the `docker-compose` `web` service. This is how it looks like:

This configuration allows me to run and debug:

However, in that case, when I start debugging, none of the breakpoints I set are respected. RubyMine simply does not pause when the breakpoints are reached, it behaves like a run configuration and not a debug one.

 

I hope you I shed some light in the problem, let me know what else you might need.

 

 

0
Comment actions Permalink

So as far as I understood you're trying to debug a Rails server Run configuration (I was asking about what exactly you'd like to debug because there's a known problem with RSpec debug)? In this case would it be possible to provide a project sample for reproduce (you can send me it to rubymine-support@jetbrains.com)?

0
Comment actions Permalink

Hi! 
I've run into a similar issue following the this tutorial. https://www.jetbrains.com/help/ruby/remote-debugging-with-product.html# 

Can you please clarify if an interactive console using remote debugging through debase and ruby-debug-ide is a feature or not?

Here is what I'm doing:
1. Run a remote rails console ` rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- ./bin/rails c`

2. In my local computer, configure and run ruby remote debug run configuration. (It attaches successfully). 

3. Set a breakpoint and run something on my remote rails console that will trigger the breakpoint.  The execution halts successfully at the breakpoint.


4. All seems fine. However, there is no "interactive console" option here and when I take a look at the "console tab" there is nothing there and I can't interact with it.

0
Comment actions Permalink

Sergio Rodriguez,

Interactive console in case of remote interpreters is planned to be supported starting from 2020.1: https://youtrack.jetbrains.com/issue/RUBY-21611

0

Please sign in to leave a comment.