Cannot add remote (docker-compose) Ruby interpreter
Answered
Hi,
I have a multi-application development environment based on passenger-docker.
I'm currently using RubyMine 2018.1.1 and I cannot add remote (docker-compose) Ruby interpreter.
The problem is the ruby interpreter path!
Can't create Ruby SDK
Can't find ruby by provided interpreter path
I tried with the following values, but it doesn't work:
- /usr/local/rvm/rubies/default/bin/ruby
- /usr/local/rvm/rubies/ruby-2.5.1/bin/ruby
- /usr/local/rvm/gems/ruby-2.5.1
- /usr/local/rvm/gems/ruby-2.5.1@global
It worked with RubyMine 2017.3 serie and the bold value.
Any idea?
Please sign in to leave a comment.
This is frustrating ...
Can you please explain me how RubyMine behaves when trying to download remote SDK. What are the requirements? Which variables must be set? If I know how it works, then I can try to find a workaround.
I recently renewed my subscription (own founds) even if there are a few issues with my setup.
Please help me.
Many thanks,
Mauro
Hello Mauro,
sorry for the delay. Could you please check how it goes in the last 2018.1.2 RC and after readding Docker configuration (Settings Build, Execution, Deployment | Docker). In case the problem persists would it be possible to provide a sample app for reproduce (you can send me it to rubymine-support@jetbrains.com)
Hi Olga,
removing all volumes and rebuilding everything seems to have fixed the problem.
I created a git repo with a development environment based on passenger-docker and other two git repo with sample applications.
I'll send you an email so that you can help me with https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000216904-Passenger-Docker-multi-app-dev-environment-how-to-setup-debug-
Many thanks,
Mauro
Hi, I have this issue again.
I tried to reset docker to factory defaults but the problem still persists.
It is really frustrating...
You can find a demo of my setup (docker based env + 2 apps) at:
https://gitlab.com/my-passenger-docker
Many thanks,
Mauro
Any update on this?
It is frustrating to pay for something that seems NOT to work.
I also created a demo of my setup in order to help with the debugging procedure, did you try it.
It is painful to develop without Ruby SDK (for autocomplete etc) & debugging.
Many thanks,
Mauro
Hello Mauro,
unfortunately at the moment there're no updates. Since you've voted for the corresponding issue (https://youtrack.jetbrains.com/issue/RUBY-21624) you'll receive a notification as soon as there's any change of the issue's state.
Hello Olga,
is there any workaround to this? Working without the SDK is painful.
BTW: https://youtrack.jetbrains.com/issue/RUBY-21624 is not the related issue.
Many thanks,
Mauro
Hey Mauro, I know it's a little late, but did you select the right application in the "service" option of the configuration?
I ask because this was happening to me and I didn't realize I had to chose the service that has a container with ruby installed on it
Hi Robcontreras, many thanks for your reply.
In my setup I have two services, one based on passenger-docker and one on mysql official image, I always chose the correct one.
My issue was related to ruby executable path. The RubyMine support team helped me a few months ago, the solution is to use the path to rvm (/usr/local/rvm/bin/rvm in my situation) and not the one to the ruby executable.
Mauro
Similar setting (Rails, Postgres and Redis container via local Docker compose) and same issue as Mauro N: "There are no rubies installed". All recommended and (via which ...) existing paths to ruby and rvm tested (not only local, but also in Rails container). Very frustrating. Any updates? Issue addressed or solved in RubyMine 2019.1?
Ruby path in Rails Container: /usr/local/bin/ruby (no RVM installed)
Local Ruby path: ~/.rvm/rubies/ruby-2.6.0/bin/ruby (no default Ruby installed)
Local RVM path: ~/.rvm/bin/rvm
Stefan
Hello Stefan,
in case you have the same issue as Mauro then it was caused by the misconfiguration. Still it'd be great if you could check how it goes in 2019.1 RC. If the problem persists then could you please share your Dockerfile, docker-compose.yml and Gemfile.
Hello Olga, thanks for your reply.
Same issue in RubyMine 2019.1 RC. I have moved from RVM to RBENV in the meantime.
Build #RM-191.6183.108, built on April 1, 2019
JRE: 1.8.0_202-release-1483-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.18.0-17-generic
/usr/local/bin/ruby (path to ruby in running container)
/home/stefan/.rbenv/shims/ruby (local)
/home/stefan/.rbenv/versions/2.6.2/bin/ruby (local)
-> Can't find ruby by provided interpreter path
/usr/bin/rbenv (local)
/home/stefan/.rbenv/bin/rbenv (local)
-> There are no rubies installed
| please share your Dockerfile, docker-compose.yml and Gemfile
PM?
Same issue for me.
No rvm involved. My setup uses plain ruby 2.5 installed at /usr/bin/ruby from alpine 3.9 package.
Readding Docker configuration as suggested by Olga had no effect.
Using /usr/bin/ruby in "Ruby or version manager path" did not fix the issue. The progress bar stalls with "Fetching version string" and another popup opens saying "Can't find ruby or interpreter path"
I cannot find any problems when running docker-compose on cli, using same setup like in rubymine settings:
docker-compose -f my-docker-compose.yml run --no-deps my-service /usr/bin/ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux-musl]
The strange thing about that:
I was lucky and one service from docker-compose.yml could be used as remote interpreter without error.
I created a duplicate of this service configuration in docker-compose.yml, just changed the service name and tried to use it as remote interpreter in rubymine. But this time, "Can't find ruby or interpreter path"
RubyMine 2019.1
Build #RM-191.6183.108, built on April 1, 2019
JRE: 1.8.0_202-release-1483-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.9.0-8-amd64
Bingo. I used the experimental feature "ruby.docker.internal.via.exec " which was suggested in https://blog.jetbrains.com/ruby/2019/03/rubymine-docker/#docker_support_updates
After disabling it, I could add all remote interpreter without problems
Thank you stmllr to point us to Experimental features! Some of my findings:
Issue 1: Inconsistent Experimental feature dis/appearing
3 x Shift > Experimental features ... > Check "ruby.docker.internal.via.exec" > Ok
Edit Configurations ... > No docker-compose area (exec / up / run) shown
Restart RubyMine IDE > Edit Configurations ... > docker-compose area shown
3 x Shift > Experimental features ... > Uncheck "ruby.docker.internal.via.exec" > Ok
Edit Configurations ... > docker-compose area (exec / up / run) still shown at exec
Restart RubyMine IDE > Edit Configurations ... > docker-compose area still shown at exec
Maybe more a feature than a bug...
Progress 1: Remote debugger for docker-compose after not intended step goes through!
Prepositions: ruby.docker.internal.via.exec is unchecked, docker-compose still shown at exec
Menu > File > Settings > Languages & Frameworks > Ruby SDK & Gems > Select interpreter Path > New remote...
Check "Docker" (not "Docker compose") > Set "Image name" to web_app (my running Rails container) > Set "Ruby or version manager path" to "/home/stefan/.rbenv/bin/rbenv" > Ok
Creating Ruby SDK > Progress bar goes through. Images busybox:latest and rubymine_helpers:RM-191.6183.108 fetched, rbenv found
URGENT: After this someway not intended step, set Remote debugger for "Docker compose" (not "Docker") goes through too in same manner!
My guess: Setting up Remote Debugger for Docker resolves over a side effect the problem with finding ruby / rvm / rbenv when setting up Remote Debugger for Docker compose. Once executed, afterwards (I suspect also on the systems of the developers of RubyMine) the bug may not occur anymore.
UPDATE: Issue 1 aggravated: Experimental feature ruby.docker.internal.via.exec now does not trigger anymore, docker-compose area in Edit Configuration is never shown more. Progress 1 not reproducible: After deleting the above successfull created remote debugger SDK, the same problem as before but for both "Docker" and "Docker compose" -> no ruby found.
Just to let other people know: the problem is due to https://youtrack.jetbrains.com/issue/RUBY-24016
On RubyMine 2019.1.1 it doesn't work anymore! Frustrating!
I'm using the path to version manager: /usr/local/rvm/bin/rvm
The returned error is:
Can't create Ruby SDK
Error getting list of installed rubies
Mauro
Hello Mauro,
it'd be great if you could provide Dockerfile, docker-compose.yml (or a project sample) for reproducing.
Hi Olga! I think i have the same issue, just cannot import remote SDK using docker-compose file
docker-compose file: https://gist.github.com/dutsik/af6e51d168a6ebcba185377d34715f5f
Dokcerfile: https://gist.github.com/dutsik/69090a55c2f00fd302e391b74805f9cf
Gemfile: https://gist.github.com/dutsik/a532534481f375515179ceec3927470e
RubyMine 2019.1.2
Build #RM-191.7141.58, built on May 14, 2019
JRE: 1.8.0_202-release-1483-b49 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
ivan
And this is the log file from Rubmine generated when i tried to add remote SDK: https://gist.github.com/dutsik/0f0b505608c5c4b0d65386fbf1c61fe3
and also some info from RubyGems Environment, that might help:
Sdk Gem paths:
null/gems/null/gems
C:/Users/THINK/.RubyMine2019.1/system/ruby_stubs/-515554029/null/gems/null/gems
C:/Users/THINK/.RubyMine2019.1/system/ruby_stubs/-515554029/null/gems/null/bundler/gems
C:/Users/THINK/.RubyMine2019.1/system/ruby_stubs/-515554029/usr/local/bundle/gems
C:/Users/THINK/.RubyMine2019.1/system/ruby_stubs/-515554029/usr/local/bundle/bundler/gems
C:/Users/THINK/.RubyMine2019.1/system/ruby_stubs/-515554029/usr/src/app/.gem/ruby/2.6.0/gems
C:/Users/THINK/.RubyMine2019.1/system/ruby_stubs/-515554029/usr/src/app/.gem/ruby/2.6.0/bundler/gems
C:/Users/THINK/.RubyMine2019.1/system/ruby_stubs/-515554029/usr/local/lib/ruby/gems/2.6.0/gems
C:/Users/THINK/.RubyMine2019.1/system/ruby_stubs/-515554029/usr/local/lib/ruby/gems/2.6.0/bundler/gems
all folders are empty
Hello @Iadutskevich,
would it be possible to check how it goes in RubyMine 2019.2 EAP with `docker-compose` in run configuration set to `up`?
Hey Olga! it worked with EAP thanks
Hi Olga! Maybe i am doing smth wrong but now i am having issues with the run/debug. Everything starts, i mean all the containers, but i just cannot load a page, receiving empty response all the time. but when i ssh into container and run wget localhost:3000 - it works. Also when I start service with just docker-compose up(with IDE override of the docker-compose) everything works as it should.
maybe u have any idea where to look for?
Thanks
@Iadutskevich,
I didn't manage to reproduce it in my project in 2019.2 Beta2 so it'd be great if you could provide a project sample for reproduce.
This happens when the docker-compose command is short living. For example mine was `bundle exec rake test` and I couldn't set this up as well. I changed it to sleep 1000 and it worked.
To provide codeinsight RubyMine must interact with container with Ruby SDK. It performs commands like "which ruby", "bundle check", "rake tasks" and others. That's why it's better to have a long working command in container (for example "tail -f /dev/null") - to prevent container from exiting
Can't you overwrite the command of docker-compose when you run it to do all those checks?
The error message is also unclear. I got something like `Couldn't find Ruby interpreter`, which was confusing because running `which ruby` by hand returned the appropriate path.
Could you try to execute "docker-compose down" and then add docker-compose SDK. In this case RubyMine will check that docker-compose project is not up and will run it with command "tail -f /dev/null" (overrides the command)