Skip to content

Instantly share code, notes, and snippets.

@johnpmitsch
Created April 4, 2019 16:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpmitsch/868e17a7b4fea15684640eb46df45f85 to your computer and use it in GitHub Desktop.
Save johnpmitsch/868e17a7b4fea15684640eb46df45f85 to your computer and use it in GitHub Desktop.
katello debugging with remote byebug
  • cd ~/foreman
  • echo "gem 'byebug'" >> bundler.d/katello.local.rb
  • bundle install
  • create and add the following to config/initializers/byebug.rb
require 'byebug/core'
if Rails.env.development?
  Byebug.start_server 'localhost', ENV.fetch("BYEBUG_SERVER_PORT", 1048).to_i
end
  • ignore in git:
echo 'config/initializers/byebug.rb' >> .git/info/exclude
echo '.byebug_history' >> .git/info/exclude
  • add byebug in code where you need a debugger
  • with server running, in another terminal, you can run bundle exec byebug -R localhost:1048 to connect to byebug
  • when your endpoint is hit, you will see the code show up in the connected byebug process.
  • use help for commands
  • quick tip: list = is the equivalent of whereami in pry
@johnpmitsch
Copy link
Author

This doesn't work with foreman start, only with foreman/script/foreman-start-dev or manually starting the rails server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment