-
Notifications
You must be signed in to change notification settings - Fork 2
Docker Console and Debugger #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
af35910
4bc2a02
6a90973
ccfc86b
b7f3994
8677912
73c44f7
cd110c0
63c1bc8
af5256b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,11 +125,18 @@ make rails-generate GENERATE_COMMAND="model Foo --primary-key-type=uuid" | |
|
||
### 🐛 Debugging | ||
|
||
Rails has some useful [built-in debugging tools](https://guides.rubyonrails.org/debugging_rails_applications.html). | ||
Rails has some useful [built-in debugging tools](https://guides.rubyonrails.org/debugging_rails_applications.html). Here are a few different options: | ||
|
||
SammySteiner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Start the rails console: `make rails-console` | ||
- Start the [rails console](https://guides.rubyonrails.org/command_line.html#bin-rails-console): `make rails-console` | ||
- Run a console in the browser: | ||
- Add a `console` line and an interactive console, similar to the rails console, will appear in the bottom half of your browser window | ||
- Add `<% console %>` to an `.erb` file and an interactive console, similar to the rails console, will appear in the bottom half of your browser window. | ||
- Note: If the console doesn't appear when running in a docker container, check to see if your IP address is added to the permissions list in [development.rb](app-rails/config/environments/development.rb) in `config.web_console.permissions`. The list is currently set to allow most internal IPs. You would also see an error in your terminal that looks something like: `Cannot render console from <your.IP.address.here>! Allowed networks: 127.0.0.0/127.255.255.255, ::1` | ||
- Run the debugger: | ||
- Add a `debugger` line and the rails server will pause and start the debugger | ||
- Note: this is not yet configured for this application when doing local development in a container | ||
- If you're running the app natively, such as with `make start-native`: | ||
- You must connect to the debugger from another terminal session because of our [Procfile.dev](app-rails/Procfile.dev) configuration. | ||
- From another terminal tab, run `rdbg -An`. | ||
- If you have multiple Rails applications with debuggers running, you'll have to specify the port to attach the debugger to. For more information, see the [Rails debug gem documentation](https://github.com/ruby/debug?tab=readme-ov-file#remote-debugging). | ||
- If you're running the app in a container, such as with `make start-container`: | ||
- `rdbg` in the terminal on your host machine will not be able to see the port in the container to connect to the debugger. | ||
- Instead, run `rdbg` inside the container: `docker compose exec app-rails rdbg -An` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running
And I needed to hit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, running
This issue is the only reference I found about this. I was able to hit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! i removed the I was only able to reproduce what you were seeing by connecting the debugger before the application hit the debug statement. But once the debug statement was hit by the user action, then the debugger terminal updated properly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see! Thanks. |
Uh oh!
There was an error while loading. Please reload this page.