Josh Rice
Josh Rice

Reputation: 47

Issue with getting RubyMine debugger to work with Docker

enter image description hereI'm setting up RubyMine Debugger with Docker but I believe I have an issue with the matching the ports and I can't find documentation that thoroughly explains what the "configuration form in ruby mine is asking for and how to find the related information for the form input fields" all I can find is generic information.

I have had many error messages and even crashing when I click the debugger button. I have tried a lot more then what I'm posting but I never wrote it down. This is just where I am at this current moment

I have followed https://confluence.jetbrains.com/display/RUBYDEV/How+to+setup+and+run+ruby+remote+debug+session

I have added ports to the docker-compose.yml file. Setup configuration for remote Remote Ruby SDK and Gem. Setup Ruby remote debug configuration. I have tried working my way through every error but I just get more as I go. This app uses docker-compose and I'm not familiar with it at all other then all the reading I been doing to get this debugger setup

docker-compose.yml file

app:
  build: wffffffe_api
  dockerfile: Dockerfile-development
  command: rails server --port 3000 --binding 0.0.0.0
  stdin_open: true
  tty: true
  ports:
    - "3000:3000"
    - "1234:1234"
    - "26162:26162"

  volumes:
    - './wfffffe_api:/var/www/weffffffe_api'
    - './dotfiles/.vimrc-basic:/root/.vimrc'

The debugger configuration

Remote host: 0.0.0.0
Remote port: 3000
Remote root folder: /var/www/wffffffe_api
local port: 26162
local root folder: /Users/josh/Work/wffffffe_api

I have tried doing

docker-compose exec app rdebug-ide --host 0.0.0.0 --port 3000 --dispatcher-port 26162 -- bin/rails server

If the docker container is already running I get: Fatal exception in DebugThread loop: Address already in use - bind(2) for "0.0.0.0" port 3000

If the docker container is not already running I get: Fast Debugger (ruby-debug-ide 0.6.1, debase 0.2.2, file filtering is supported) listens on 0.0.0.0:3000

I then do docker-compose up --build -d ERROR: for app Cannot start service app: b'driver failed programming external connectivity on endpoint work_app_1 (1e830daaecd39fab784b817a03893b592635542a8dfe3de69859c0ba7d39b483): Error starting userland proxy: Bind for 0.0.0.0:3000 failed: port is already allocated'

Do I need to have two separate servers running?

Upvotes: 2

Views: 3997

Answers (1)

Shahar Glazner
Shahar Glazner

Reputation: 427

Your problem is that you are trying to debug on port 3000, which already bound by your rails application.

The --port of rdebug-ide specify the port that RubyMine will use for its debug protocol.

When you execute rails server --port 3000 --binding 0.0.0.0, you are binding port 3000 as your rails application (and not as debug port).

Change your remote port debug to 1234 (which you already exposed in your docker-compose.yml) and it should work.

To summarise, your command should look like:

docker-compose exec app rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- bin/rails server --port 3000 --binding 0.0.0.0

Upvotes: 2

Related Questions