GabLeRoux / GabLeRoux/rails-docker-compose-rubymine-example

Unable to run tests inside docker with Intellij IDEA (works in RubyMine) which leads to "Uncaught exception: Unknown MySQL server host 'db'"

Open
#1 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
16
Forks
3
PR merge metrics
No merged PRs in 30d

Description

With Intellij IDEA 2017.3.2, I am unable to execute code inside docker for any run configuration. It always use my local ruby which is pointless.

> Uncaught exception: Unknown MySQL server host 'db' (0)

```
Testing started at 14:37 ...
/Users/gableroux/.rbenv/shims/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/gableroux/.gem/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 54295 --host 0.0.0.0 --dispatcher-port 54296 -- /Users/gableroux/repos/ruby/rails-docker-compose-rubymine-example/bin/rspec /Users/gableroux/repos/ruby/rails-docker-compose-rubymine-example/spec/models/user_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example "User #email returns a string"
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.1, file filtering is supported) listens on 0.0.0.0:54295
Uncaught exception: Unknown MySQL server host 'db' (0)
/Users/gableroux/.gem/gems/mysql2-0.3.21/lib/mysql2/client.rb:70:in `connect'
/Users/gableroux/.gem/gems/mysql2-0.3.21/lib/mysql2/client.rb:70:in `initialize'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `new'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `mysql2_connection'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/Users/gableroux/.rbenv/versions/2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/Users/gableroux/.rbenv/versions/2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/connection_handling.rb:87:in `connection'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/migration.rb:857:in `needs_migration?'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/migration.rb:396:in `load_schema_if_pending!'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/migration.rb:411:in `block in maintain_test_schema!'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/migration.rb:642:in `suppress_messages'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in `method_missing'
/Users/gableroux/.gem/gems/activerecord-4.2.5/lib/active_record/migration.rb:411:in `maintain_test_schema!'
/Users/gableroux/repos/ruby/rails-docker-compose-rubymine-example/spec/rails_helper.rb:27:in `'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/configuration.rb:1295:in `require'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/configuration.rb:1295:in `block in requires='
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/configuration.rb:1295:in `each'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/configuration.rb:1295:in `requires='
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/configuration_options.rb:109:in `block in process_options_into'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/configuration_options.rb:108:in `each'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/configuration_options.rb:108:in `process_options_into'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/configuration_options.rb:21:in `configure'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/runner.rb:101:in `setup'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/runner.rb:88:in `run'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/runner.rb:73:in `run'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/lib/rspec/core/runner.rb:41:in `invoke'
/Users/gableroux/.gem/gems/rspec-core-3.4.0/exe/rspec:4:in `'
/Users/gableroux/repos/ruby/rails-docker-compose-rubymine-example/bin/rspec:7:in `load'
/Users/gableroux/repos/ruby/rails-docker-compose-rubymine-example/bin/rspec:7:in `'

Process finished with exit code 0
```

Stacktraces are the same for both rails and idea

It looks like it's pointless to have `docker` and `docker-compose` remote integration if it can't run configurations in them. The only thing you get from setting it in Docker with Intellij is to get the IDE completions or I'm doing something wrong 👈

This is the execution when using the docker integration in RubyMine:

```bash
Testing started at 15:14 ...
/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.0/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 1234 --host 0.0.0.0 --dispatcher-port 26168 -- /opt/project/bin/rspec /opt/project/spec/models/user_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example "User #email returns a string"
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.1, file filtering is supported) listens on 0.0.0.0:1234
Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array ({"GEM_PATH"=>["/usr/local/bundle", "/root/.gem/ruby/2.2.0", "/usr/local/lib/ruby/gems/2.2.0"]}) was passed in from /opt/project/bin/rspec:3:in `load'
Run options: include {:full_description=>/User\ \#email\ returns\ a\ string/}
```

For example above, `/usr/local/bundle/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide` is actually **inside** docker.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.