Add configurations to enable remote IDE debugging with rdebug-ide

flag=none

test plan:
- Update your .env to include docker-compose/rdebug-ide.override.yml
  in the COMPOSE_FILE variable
- Start your Docker environment
- Configure remote debugging in VS Code or RubyMine
  (see https://instructure.atlassian.net/wiki/x/BACP-w)
- Launch the remote debugger and set a breakpoint somewhere ubiquitous
  (e.g. in `ApplicationController`)
- Navigate to your local Canvas and confirm
  that your breakpoint

Change-Id: I87d7bed838e7a593201a4bfd21f911216329343b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270409
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
This commit is contained in:
Jon Scheiding 2021-07-30 16:21:26 -04:00
parent 319f5b45e7
commit 1d688efeb0
6 changed files with 46 additions and 0 deletions

14
.vscode/launch.json.example vendored Normal file
View File

@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug with rdebug-ide",
"type": "Ruby",
"request": "attach",
"remoteHost": "127.0.0.1",
"remotePort": "1234",
"remoteWorkspaceRoot": "/usr/src/app",
"cwd": "${workspaceRoot}"
}
]
}

View File

@ -25,4 +25,6 @@ group :development do
gem 'spring-commands-rubocop', '0.2.0'
gem 'byebug', '11.1.3', platform: :mri
gem 'debase', '0.2.4.1', require: false
gem 'ruby-debug-ide', '0.7.2', require: false
end

View File

@ -50,6 +50,9 @@ environment_configuration(defined?(config) && config) do |config|
puts "Byebug listening on 0.0.0.0:#{Byebug.actual_port}" # rubocop:disable Rails/Output
byebug_port_file = File.join(Dir.tmpdir, 'byebug.port')
File.write(byebug_port_file, Byebug.actual_port)
require 'debase'
require 'ruby-debug-ide'
end
end

View File

@ -22,6 +22,7 @@ services:
environment:
<<: *BASE-ENV
VIRTUAL_HOST: .canvas.docker
VIRTUAL_PORT: 80
HTTPS_METHOD: noredirect
postgres:

View File

@ -0,0 +1,8 @@
version: '2.3'
services:
web:
command: docker-compose/rdebug-ide.sh
ports:
- 1234:1234
environment:
- REMOTE_DEBUGGING_ENABLED=1

18
docker-compose/rdebug-ide.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
#
# pidfile will get left behind when debugging is terminated,
# we need to clean it up to avoid "server is already running"
#
PIDFILE="/usr/src/app/tmp/pids/server.pid"
if [ -f "$PIDFILE" ]; then
rm "$PIDFILE"
fi
bundle exec rdebug-ide \
--host 0.0.0.0 \
--port 1234 --dispatcher-port 26162 \
--skip-wait-for-start \
-- \
bin/rails s -p 80 -b 0.0.0.0