RubyMine
Overview
Website: https://www.jetbrains.com/ruby/
Best for: editing Ruby or Rails applications, which can include Javascript/Typescript and most other web technologies.
Common Jetbrains Setup and Configuration
Jetbrains IDEs are standardized, so much of the setup and configuration information applies to all IDEs, and can be found under Common Jetbrains Setup and Configuration.
Specific config for RubyMine can be found in the sections below.
Using Rubymine debugger for GitLab running under GDK
Debugging rails-web
Note on Rails Puma binding
By default, the Rails puma configuration template which GitLab uses binds to a socket, instead of a TCP port.
This MR added support for configuring the GDK to bind Rails puma to a TCP socket, and added support for Workhorse to use TCP ports instead of sockets, and this JetBrains issue added support for starting a socket-based Puma server in a Run Configuration.
See the architecture documentation around components for more details on how GitLab Workhorse and Puma work together.
Setting up a RubyMine “Ruby” Run Configuration with puma using default socket binding
- Make sure you have done
gdk stop rails-web
before each debugging session (andgdk start rails-web
when you are done debugging) - In RubyMine, open the gitlab repo directory from
/path/to/gdk/gitlab
(Cloning gitlab and running it from a different directory won’t work out of the box) - Go to
Run -> Edit Configurations
to set up a Rails Run/Debug config like this in RubyMine:- Name:
GitLab: rails-web
- Configuration:
- Server:
Puma
- IP address: BLANK (delete
0.0.0.0
) - Port: BLANK (delete
3000
) - Environment:
development
- Environment Variables (Note: these are taken from the current GDK
Procfile
, as well as additional ones to prevent timeouts during debugging. They may become outdated):RAILS_RELATIVE_URL_ROOT=/;ACTION_CABLE_IN_APP=true;ACTION_CABLE_WORKER_POOL_SIZE=4;FIPS_MODE=false;GEO_SECONDARY_PROXY=0;GITLAB_RAILS_RACK_TIMEOUT=999999;GITLAB_RAILS_WAIT_TIMEOUT=999999;GITALY_DISABLE_REQUEST_LIMITS=false
- NOTE: The following values from the Procfile entry are omitted as they are not necessary:
BUNDLE_GEMFILE
ENABLE_BOOTSNAP
RAILS_ENV
- Server:
- Name:
- Start the config in Run (“Play” ▶️ button) or Debug mode (at top right)
Debugging rails-background-jobs
To debug services run as background jobs, you will need to set up debugging for rails-background-jobs
, in addition to the rails-web
debugger. The setup is similar, although you’re connecting to the sidekiq process instead of puma.
- Make sure you have done
gdk stop rails-background-jobs
before each debugging session (andgdk start rails-background-jobs
when you are done debugging) - Go to
Run -> Edit Configurations
to set up a Ruby (NOT Rails) Run/Debug config like this in RubyMine:- Name:
GitLab: rails-background-jobs
- Ruby Script:
/Users/YOUR_USER/.asdf/installs/ruby/RUBY_VERSION/bin/sidekiq
- Working Directory
/Users/YOUR_USER/PATH_TO/gitlab-development-kit/gitlab/
- Environment Variables (Note: these are taken from the current GDK
Procfile
, they may become outdated):SIDEKIQ_VERBOSE=false;SIDEKIQ_QUEUES=default,mailers,email_receiver,hashed_storage:hashed_storage_migrator,hashed_storage:hashed_storage_project_migrate,hashed_storage:hashed_storage_project_rollback,hashed_storage:hashed_storage_rollbacker,project_import_schedule,service_desk_email_receiver;SIDEKIQ_WORKERS=1;RAILS_RELATIVE_URL_ROOT=/;GITALY_DISABLE_REQUEST_LIMITS=false
- NOTE: The following values from the Procfile entry are omitted as they are not necessary:
BUNDLE_GEMFILE
ENABLE_BOOTSNAP
RAILS_ENV
- Environment Variables (Note: these are taken from the current GDK
- Name:
Configuring GDK database connection
First, follow the “Access the database with a GUI” instructions to reconfigure postgresql under the GDK to run on localhost.
Then configure the develoment database:
- Go to
File -> New -> Data Source -> Postgresql
(or from theDatabases
tab on the right border) - Enter a name:
gitlabhq_development@localhost
- Host:
localhost
- Port:
5432
- Authentication
User & Password
- User - leave blank
- Password: leave default, shows
<hidden>
- URL (auto-calculated from the above fields):
jdbc:postgresql://localhost:5432/gitlabhq_development
- Download driver if needed.
- Click
Test Connection
.
Then access the database:
- Open the
Databases
panel from the right border - Click the Refresh button (circle arrows)
- Expand to see tables/views/etc.
If you want to add more schemas from config/database.yml
:
- Go to
Database
tab - Right click on top level of database, and view
Properties
(or the “wrench” button) - Go to the
Schemas
tab - Select the schemas you want.
Miscellaneous
- To enable “Navigate to Test” (Cmd + Shift + t) for EE code, right click on
ee/spec
directory and choose “Mark Directory As…”, “Test Sources”.
b7b029c9
)