Ruby Debugger from docker-compose app activates the tool window but doesn't return any feedback

I don't want to file it as a (couple) of bugs before asking here.

Rails 5 app setup in docker-compose. Both the rails console and rails server run fine in the tool window. Everything works well in the app, however, when you try to use the debug a few things happen:

1. At launch the debug console complains about missing the ruby-debug-ide gem. That is probably the first bug.  Indeed the docker plugin seems to miss to start or mount the rubymine_helpers in the dedicated container since I `ls` it and the gems are there. As a workaround I manually installed the gem (along with the debase gem) from inside the container: they installed and compiled fine.

2. Re-launching the debug-console withh the installed gems I get the executed command in the tool window:

/usr/local/bin/ruby -e at_exit{sleep(1)};$$stdout.sync=true;$$stderr.sync=true;load($$0=ARGV.shift) /usr/local/bundle/gems/ruby-debug-ide-0.6.1.beta9/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --evaluation-control --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --port 1234 --host --dispatcher-port 26168 -- /app/bin/rails console
Fast Debugger (ruby-debug-ide 0.6.1.beta9, debase 0.2.1, file filtering is supported) listens on

and the >> of the input prompt, but no welcome message "Loading development environment (Rails 5.0.2)". It looks like it is frozen somewhere or the tool window has no connection with the process and just echoes whatever I write in the input line, returning no feedback/response.

What should I check/do? Should I file a bug for the missing ruby-debug-ide that I had to install manually (despite the helper container)? Where could I find some log of what happens to the debugging process? Could you suggest any possible workaround? I am in the middle of a complex job, so it is very important to get the debugger working ASAP.


Comment actions Permalink


the gems required for debug need to be added to the Gemfile. Could you please try setting docker debug up as it's described in the following help article:

Comment actions Permalink

Thanks for your answer.

Yes, I did that already, and I double checked after your post. The only discrepancy is that the page list as a requirement the Docker Compose Integration plugin (which doesn't exist, so I guess it is a typo and it means Docker Integration plugin). The only difference is that I installed the latest beta gems, not the old listed in the page. 

gem 'debase', '0.2.2.beta11'
gem 'ruby-debug-ide', '0.6.1.beta9'

I also created another project with a new rails app, and the result is exactly the same. What should I do next?


Comment actions Permalink

Thanks for the finding typo! I've reported an issue to our bug-tracker.

Could you please make sure that you have re-build container with a latest ruby-debug-ide versions? If yes, please re-add docker-compose SDK in the Setting again. Let me know if it doesn't help.

Comment actions Permalink

Thank you again... and I have to say that again, I already tried what you said, but nothing changed. I tried it again to be sure.

BTW, I don't need to re-build any image on gem change, since I use an app image with volumes mapped to host dirs. It installs gems and binaries on writable dirs, so it doesn't have to re-create new images all the times I do a bundle install.

I added all the ENV to both the SDK and the Run tool. I tried to use the irb.rb binary in the local installed rubymine (Default proposed by the tool window) and also change thata to the `bin/rails console` in the app: the problem remain the same.

I checked with the Show Gem Environment tool and it looks all ok:

RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x86_64-linux]
USER INSTALLATION DIRECTORY: /home/dd/.gem/ruby/2.4.0
RUBY EXECUTABLE: /usr/local/bin/ruby
EXECUTABLE DIRECTORY: /usr/local/bundle/bin
SPEC CACHE DIRECTORY: /home/dd/.gem/specs
:update_sources => true
:verbose => true
:backtrace => false
:bulk_threshold => 1000
"install" => "--no-document"
"update" => "--no-document"
IDE: RubyMine 2017.3, build #RM-173.3727.77
OS: Linux 4.13.0-17-generic[amd64]
Java: 1.8.0_152-release-1024-b6
RubyMine SDK Environment:
Sdk: Remote: ruby-2.4.2-p198 (2)
Sdk Version: ver.2.4.2p198 ( revision 59899) p198
Ruby Interpreter: docker-compose://[/home/dd/RubymineProjects/demo/demodocker/docker-compose.yml]:app//usr/local/bin/ruby
RVM Sdk: no
RVM Home: [n/a]
Sdk Language Level: 2.4
Sdk Load Path:
Sdk Gem paths:
Gems used for 'demo':
bindex (0.5.0)
method_source (0.9.0)
rake (12.3.0)
sqlite3 (1.3.13)
actionpack (5.0.6)
actionview (5.0.6)
listen (3.0.8)
sass (3.5.3)
activejob (5.0.6)
multi_json (1.12.2)
erubis (2.7.0)
turbolinks-source (5.0.3)
sass-rails (5.0.7)
uglifier (3.2.0)
web-console (3.5.1)
rails-dom-testing (2.0.3)
minitest (5.10.3)
thread_safe (0.3.6)
actionmailer (5.0.6)
rb-fsevent (0.10.2)
crass (1.0.3)
spring-watcher-listen (2.0.1)
concurrent-ruby (1.0.5)
mini_mime (1.0.0)
activesupport (5.0.6)
bundler (1.16.0)
sprockets-rails (3.2.1)
debase-ruby_core_source (0.10.0)
nokogiri (1.8.1)
spring (2.0.2)
ffi (1.9.18)
tilt (2.0.8)
jquery-rails (4.3.1)
mail (2.7.0)
globalid (0.4.1)
websocket-driver (0.6.5)
puma (3.11.0)
activerecord (5.0.6)
coffee-script-source (1.12.2)
sass-listen (4.0.0)
websocket-extensions (0.1.3)
execjs (2.7.0)
rails-html-sanitizer (1.0.3)
activemodel (5.0.6)
actioncable (5.0.6)
loofah (2.1.1)
mini_portile2 (2.3.0)
builder (3.2.3)
coffee-rails (4.2.2)
coffee-script (2.4.1)
tzinfo (1.2.4)
nio4r (2.1.0)
rack-test (0.6.3)
ruby-debug-ide (0.6.1.beta9)
sprockets (3.7.1)
debase (0.2.2.beta11)
thor (0.20.0)
arel (7.1.4)
rb-inotify (0.9.10)
turbolinks (5.0.1)
railties (5.0.6)
byebug (9.1.0)
i18n (0.9.1)
jbuilder (2.7.0)
rack (2.0.3)
rails (5.0.6)

However, I got a warning in the file log (I don't know when it writes it exactly), but it looks quite interesting:

2017-11-28 07:20:41,063 [2202824]   WARN - brains.plugins.ruby.gem.GemBox - Unable to find lib directory /home/dd/.RubyMine2017.3/system/ruby_stubs/259393814/-1480059672/../lib/ruby/2.4.0for Remote: ruby-2.4.2-p198 (2): ver.2.4.2p198 ( revision 59899) p198 (docker-compose://[/home/dd/RubymineProjects/demo/demodocker/docker-compose.yml]:app//usr/local/bin/ruby) 

The ruby_stubs directory is full of quite cryptic numbered dirs though. The interesting thing is that apparently it looks to find a lib directory for ruby itself, while there is no lib/ruby dir into the ruby_stub dir

/home/dd/.RubyMine2017.3/system/ruby_stubs/259393814/-1480059672 is a dir and contains a bunch of bins including rdebug-ide, no dirs. The dir ../lib/ruby/2.4.0 looks weird to me. Could it be the culprit of the problem or is it just a warning that would have a fallback and/or no consecuences?


Comment actions Permalink

Is there any documentation about how to use it with byebug and debugger-xml? I tried to install that, but debugger-xml is missing a lot of require statement for the byebug modules that it includes or patches, and it is a pain going after all that. I am probably missing something: is there a guide to install and configure the RubyMine debugger correctly with byebug? Thanks.

Comment actions Permalink

Could you please provide an example of docker-compose.yml and Dockerfile that you're using.

As for debugger, in case you use external one you don't need to configure RubyMine's one.

Comment actions Permalink

About the debug, you should change the information in this page since it states that you can use an external debugger like byebug with the rubymine debugger and the debugger-xml gem. I tried that, and RubyMine correctly starts the rdebug of the gem, so the feature is still both in the documentation and in the code. However, it raises a few errors: I contacted the author of the debugger-xml gem and sadly he said that the gem is not maintained anymore since 3 years ago! Time to update doc and code. ;)

Dockerfile: ddnexus/app:lat

FROM ruby:latest

RUN curl -sL | bash - \
&& apt-get update \
&& apt-get install -y \
nodejs \
git \

# users and passwords
# notice the user will be created with uid=1000 gid=1000 group=$user
# edit the following lines if you need a different setup
ARG user="dd"
ARG password="rubydev"
ARG root_password=$password
RUN adduser --disabled-login --gecos "" $user \
&& echo $user:$password | chpasswd \
&& echo root:$root_password | chpasswd

RUN echo "\n\n\
export EDITOR=nano\n\
export SHELL=/bin/bash\n\
export TERM=xterm\n\
export LS_OPTIONS='--color=auto'\n\
eval \"`dircolors -b`\"\n\
alias ls='ls \$LS_OPTIONS'\n\
alias ll='ls \$LS_OPTIONS -l'\n\
alias l='ls \$LS_OPTIONS -lA'\n\
export RAILS_ENV=development\n"\
>> /etc/bash.bashrc

SHELL=/bin/bash \
TERM=xterm \



VOLUME /usr/local/bundle
VOLUME /home/$user
VOLUME /root


version: "3.0"


# user: "dd"
image: ddnexus/app:latest
- ../.:/app
- ./volumes/app/bundle:/usr/local/bundle
- ./volumes/app/dd:/home/dd
- ./volumes/app/root:/root
- "3000:3000" # rails server

# the following 2 lines allow the container to keep running
# even in detached mode without any foreground process running
stdin_open: true
tty: true

NOTICE: If you actually intend to run the thing: I commented out the user, so the container will run as root. The "dd" user makes sense only in my own environment and you would have to create a "dd" user in your own host and chown to it the volumes dir. So it is better you run it as root.

Comment actions Permalink

We have troubles configuring project with provided docker-compose.yml and Dockerfile. Could you help us to configure the project?

1)Project structure.
Am I right that Dockerfile and docker-compose.yml configured to serve project with the following structure:
- app
- bin
- config
- Dockerfile
- docker-compose.yml
- Gemfile
- Gemfile.lock
- app
- - bundle
- - dd
- - root

2)Gem installation.
How do you install gems? I suppose that you run something like
`docker run -it ddnexus/app:latest bundle install`
and gems installed into volumes/app/bundle of your project?

Comment actions Permalink

Yes exactly: you get it perfectly. The structure is correct. I usually create a docker tool in Rubymine, then I execute bash so I have a bash console. Then inside it I run bundle install. What are the problems you have? 

I am spending a lot of time (sadly, more time to debug RubyMine than to debug my own code), so in order to save time on both sides I am available to a live share screen on google for example. If we can talk interactively we can pinpoint the problem a lot faster than trying to explain it by one message per day. If you want to organize it, pleasse, let me know in a private email.

It looks like RubyMine has problems with its own stubs. It is not a problem of misconfiguration on my side because I get everything working but the debugger.

The other big problem of usability is also that RM does a docker-compose down and up every time you gives a command, so it is super slow and stressful to use. Until RM will reuse the services in the docker-compose instead restarting everything each time, I think it is a lot better to setup a docker-compose with a SSH server and let it run, then create a remote SSH SDK that connects with the docker-compose services. I already got it working: the problem are the stubs: the remote console works, but the SDK doesn't find any gem. Funny. Of course the debugger does not work because it cannot even understand that the gems are installed because the stubs are empty. Stressful!


Comment actions Permalink

BTW, this is a bug and I found a different setup in order to work with a docker-compose app, complete with debugger and a lot faster than using the docker-compose SDK that shuts down and up the services each time you have to interact with it!

You prepare a docker compose app complete with all its services, plus you add the openssh-server and rsync to the dockerfile of the app service. Then you use a Remote SDK > SSH Credential, and it works perfectly with the debugger. You start it up manually, and RM works as fast as if you have the app running in the host. Working debug and no more shutting down and starting up services.

The only problem is that I found a bug in the way RM uses rsync to copy the ruby_stubs from the remote it ignores the port of the ssh server, so you cannot setup many app at the same time, because you must use port 22 (until the bug will be fixed).

Comment actions Permalink

I've just found out that if remove 

    stdin_open: true
tty: true

debug works fine. 


Comment actions Permalink

Good catch! Thanks.

So is the debugger incompatible with that statements in docker-compose language version 3 or will it be fixed to be resilient to that?

Comment actions Permalink

We need some time to investigate how it affects and how we could avoid it.


Please sign in to leave a comment.