Setting up RubyMine for debugging

Hi,
I am fairly new to Discourse and Ruby/Ruby on Rails development. I’ve installed Discourse on my Mac (my main dev box). I followed instructions here, discourse/DEVELOPMENT-OSX-NATIVE.md at main · discourse/discourse · GitHub, to setup dev environment, which is working now.
I’d like to run Discourse service on RubyMine but when start debugging, I am getting the following errors. Can anyone please help? Or is there a doc for setting up RubyMine debugging environment?

Thanks!

/bin/zsh -c "bash -c '/Users/<user name>/.rvm/bin/rvm ruby-3.0.0 do /Users/<user name>/.rvm/rubies/ruby-3.0.0/bin/ruby /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/ruby-debug-ide-0.7.1.beta3/bin/rdebug-ide --key-value --disable-int-handler --evaluation-timeout 10 --evaluation-control --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --port 57512 --host 0.0.0.0 --dispatcher-port 57513 -- /Users/<user name>/workspace/discourse/discourse/bin/rails server -b 0.0.0.0 -p 3000 -e development'"
Fast Debugger (ruby-debug-ide 0.7.1.beta3, debase 0.2.5.beta2, file filtering is supported) listens on 0.0.0.0:57512
Subprocess Debugger (ruby-debug-ide 0.7.1.beta3, debase 0.2.5.beta2, file filtering is supported) listens on 0.0.0.0:57518
Subprocess Debugger (ruby-debug-ide 0.7.1.beta3, debase 0.2.5.beta2, file filtering is supported) listens on 0.0.0.0:57524
I, [2021-08-13T11:01:52.640502 #34275]  INFO -- : Refreshing Gem list
Starting CSS change watcher
/Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client': could not connect to server: No such file or directory (ActiveRecord::ConnectionNotEstablished)
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_handling.rb:283:in `connection'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_settings/db_provider.rb:61:in `table_exists?'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_settings/db_provider.rb:16:in `all'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_settings/defaults_provider.rb:29:in `db_all'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_setting_extension.rb:298:in `block in refresh!'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_setting_extension.rb:295:in `synchronize'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_setting_extension.rb:295:in `refresh!'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_setting_extension.rb:530:in `block in setup_methods'
	from /Users/<user name>/workspace/discourse/discourse/config/initializers/004-message_bus.rb:121:in `<main>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:326:in `block in load'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:326:in `load'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:681:in `block in load_config_initializer'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.3.2/lib/active_support/notifications.rb:205:in `instrument'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:680:in `load_config_initializer'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:634:in `block (2 levels) in <class:Engine>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:633:in `each'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:633:in `block in <class:Engine>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:32:in `run'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:50:in `each'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:50:in `tsort_each_child'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `call'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `call'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/application.rb:384:in `initialize!'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/railtie.rb:207:in `public_send'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/railtie.rb:207:in `method_missing'
	from /Users/<user name>/workspace/discourse/discourse/config/environment.rb:7:in `<top (required)>'
	from config.ru:7:in `require'
	from config.ru:7:in `block in <main>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `instance_eval'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `initialize'
	from config.ru:1:in `new'
	from config.ru:1:in `<main>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/lib/unicorn.rb:54:in `eval'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/lib/unicorn.rb:54:in `block in builder'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:826:in `build_app!'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:140:in `start'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/bin/unicorn:128:in `<top (required)>'
	from /Users/<user name>/workspace/discourse/discourse/bin/unicorn:96:in `load'
	from /Users/<user name>/workspace/discourse/discourse/bin/unicorn:96:in `block in <main>'
	from (eval):7:in `block in fork'
	from (eval):7:in `fork'
	from (eval):7:in `fork'
	from /Users/<user name>/workspace/discourse/discourse/bin/unicorn:95:in `<main>'
/Users/<user name>/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `new'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:78:in `new_client'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.3.2/lib/active_record/connection_handling.rb:283:in `connection'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_settings/db_provider.rb:61:in `table_exists?'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_settings/db_provider.rb:16:in `all'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_settings/defaults_provider.rb:29:in `db_all'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_setting_extension.rb:298:in `block in refresh!'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_setting_extension.rb:295:in `synchronize'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_setting_extension.rb:295:in `refresh!'
	from /Users/<user name>/workspace/discourse/discourse/lib/site_setting_extension.rb:530:in `block in setup_methods'
	from /Users/<user name>/workspace/discourse/discourse/config/initializers/004-message_bus.rb:121:in `<main>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:326:in `block in load'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:326:in `load'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:681:in `block in load_config_initializer'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.3.2/lib/active_support/notifications.rb:205:in `instrument'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:680:in `load_config_initializer'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:634:in `block (2 levels) in <class:Engine>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:633:in `each'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/engine.rb:633:in `block in <class:Engine>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:32:in `run'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:50:in `each'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:50:in `tsort_each_child'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `call'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `call'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
	from /Users/<user name>/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/application.rb:384:in `initialize!'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/railtie.rb:207:in `public_send'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/railties-6.1.3.2/lib/rails/railtie.rb:207:in `method_missing'
	from /Users/<user name>/workspace/discourse/discourse/config/environment.rb:7:in `<top (required)>'
	from config.ru:7:in `require'
	from config.ru:7:in `block in <main>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `instance_eval'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `initialize'
	from config.ru:1:in `new'
	from config.ru:1:in `<main>'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/lib/unicorn.rb:54:in `eval'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/lib/unicorn.rb:54:in `block in builder'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:826:in `build_app!'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:140:in `start'
	from /Users/<user name>/.rvm/gems/ruby-3.0.0/gems/unicorn-6.0.0/bin/unicorn:128:in `<top (required)>'
	from /Users/<user name>/workspace/discourse/discourse/bin/unicorn:96:in `load'
	from /Users/<user name>/workspace/discourse/discourse/bin/unicorn:96:in `block in <main>'
	from (eval):7:in `block in fork'
	from (eval):7:in `fork'
	from (eval):7:in `fork'
	from /Users/<user name>/workspace/discourse/discourse/bin/unicorn:95:in `<main>'

Process finished with exit code 0

I don’t think we have any specific RubyMine docs, but judging from that backtrace you forgot to start the PostgreSQL service.

1 Like

Thank for the prompt reply!
I have the service started (on Postgres.app, the “stop” button is enabled).
If I ran $createuser --createdb --superuser postgres on terminal, I got
createuser: error: creation of new role failed: ERROR: role "postgres" already exists error so the service should be up and running.

And are you using RubyMine for debugging Ruby on Rails code or something else? We just need a debug IDE and doesn’t matter what tool as long as we can have one.

If the service is not running, running the command psql -d postgres -c will return error:
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
But the error from RubyMine is connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Looks like RubyMine is using /tmp/ for Postgres folder. What changes should I make to point that to /var/pgsql_socket instead?
sudo ln -s /tmp/.s.PGSQL.5432 /var/pgsql_socket/ doesn’t seem to work

Finally got passed this error. My symlink was wrong, should be ln -s /var/pgsql_socket/.s.PGSQL.5432 /tmp/.s.PGSQL.5432

Thanks for the help!