Remote Debug Docker/Kubernetes

Hi, i'm trying to remote debug a rails 6.0.3 app, with the following stack: Ruby 2.6.6-alpine - Docker Engine v20.10.2 - Kubernetes v1.19.3 - Skaffold v1.17.2 - MacOS BigSur 11.1

The command to start the image is the following:

CMD ["rdebug-ide", "--debug", "--host", "0.0.0.0", "--port", "1234", "--dispatcher-port", "26162", "--", "bin/bundle", "exec", "rails", "s"]

and ports 1234/3000 are open on the image.

Gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.6'

gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 4.1'
gem 'jbuilder', '~> 2.7'
gem 'redis', '~> 4.2', '>= 4.2.5'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'

gem 'apipie-rails', '~> 0.5.18'
gem 'faraday', '~> 1.3'

gem 'bunny', '~> 2.4'
gem 'sneakers', '~> 2.3', '>= 2.3.5'

gem 'debase'
gem 'ruby-debug-ide'

group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
gem 'listen', '~> 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'rubocop', '~> 0.75.0', require: false
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

 

Setup is done following the official guide for rubymine https://www.jetbrains.com/help/ruby/remote-debugging-with-product.html#configure_remote_interpreter

(using the configuration for a docker image, not the one for ssh)

When i start the debugger, i have this error:

[system-management] Connected from local client
[system-management] 1: Starting control thread
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:25
[system-management] 1: <breakpointAdded no="1" location="/project/app/controllers/api/v1/services_controller.rb:25"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:28
[system-management] 1: <breakpointAdded no="2" location="/project/app/controllers/api/v1/services_controller.rb:28"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:29
[system-management] 1: <breakpointAdded no="3" location="/project/app/controllers/api/v1/services_controller.rb:29"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:27
[system-management] 1: <breakpointAdded no="4" location="/project/app/controllers/api/v1/services_controller.rb:27"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:7
[system-management] 1: <breakpointAdded no="5" location="/project/app/controllers/api/v1/services_controller.rb:7"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:24
[system-management] 1: <breakpointAdded no="6" location="/project/app/controllers/api/v1/services_controller.rb:24"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:11
[system-management] 1: <breakpointAdded no="7" location="/project/app/controllers/api/v1/services_controller.rb:11"/>
[system-management] 1: Processing in control: start
[system-management] 1: Starting: running program script
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/multiprocess/starter.rb:3:in `<top (required)>': undefined method `split' for nil:NilClass (NoMethodError)
[system-management]     from bin/rails:1:in `require'
[system-management] Fast Debugger (ruby-debug-ide 0.7.2, debase 0.2.4.1, file filtering is supported) listens on 0.0.0.0:1234
WARN[3324] exit status 1                                
[system-management] error: unexpected EOF

Looking for a solution i found a post where was suggested to add 2 env (DEBUGGER_STORED_RUBYLIB '' - ENV RUBYLIB '') to get rid of that, but the problem is still here:

[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:24

[system-management] 1: <breakpointAdded no="7" location="/project/app/controllers/api/v1/services_controller.rb:24"/>

[system-management] 1: Processing in control: start

[system-management] 1: Starting: running program script

[system-management] bundler: failed to load command: rails (/usr/local/bundle/bin/rails)

[system-management] Uncaught exception: Could not find mini_portile2-2.5.0 in any of the sources

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/spec_set.rb:87:in `block in materialize'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/spec_set.rb:81:in `map!'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/spec_set.rb:81:in `materialize'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/definition.rb:175:in `specs'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/definition.rb:245:in `specs_for'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/definition.rb:227:in `requested_specs'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/runtime.rb:91:in `block in definition_method'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/runtime.rb:20:in `setup'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler.rb:148:in `setup'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/setup.rb:20:in `block in <top (required)>'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/ui/shell.rb:136:in `with_level'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/ui/shell.rb:88:in `silence'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/setup.rb:20:in `<top (required)>'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:61:in `require_relative'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:61:in `kernel_load'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:28:in `run'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/cli.rb:494:in `exec'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/cli.rb:30:in `dispatch'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/cli.rb:24:in `start'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/exe/bundle:49:in `block in <top (required)>'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/exe/bundle:37:in `<top (required)>'

[system-management] /project/bin/bundle:113:in `load'

[system-management] /project/bin/bundle:113:in `<top (required)>'

[system-management] /usr/local/bundle/bin/rdebug-ide:23:in `load'

[system-management] /usr/local/bundle/bin/rdebug-ide:23:in `<main>'

[system-management] /usr/local/bundle/gems/bundler-2.2.7/lib/bundler/spec_set.rb:87:in `block in materialize': Could not find mini_portile2-2.5.0 in any of the sources (Bundler::GemNotFound)

mini_portile2-2.5.0 is correctly installed in image's gemset.

Can someone help me with this issue?

1 comment
Comment actions Permalink

Hello,

we have a corresponding feature request on our tracker so could you please add your vote to it: https://youtrack.jetbrains.com/issue/RUBY-26926

1

Please sign in to leave a comment.