views:

408

answers:

3

I've installed Rack-Bug for my Rails app, but can't get the panels to appear.

project: http://github.com/brynary/rack-bug additional instructions: http://wiki.github.com/brynary/rack-bug/security yet more instructions: http://stackoverflow.com/questions/1912983/rack-bug-installation-issue-server-does-not-start (the docs really suck for this one)

From the top:

I added config.middleware.use 'Rack::Bug' to config/environments/development.rb. I added a file config/initializers/rack_bug.rb containing the following:

require 'rack/bug'
require 'ipaddr'

ActionController::Dispatcher.middleware.use Rack::Bug,
  :ip_masks   => [IPAddr.new('192.168.2.2')],
  :secret_key => 'epT5uCIchlsHCeR9dloOeAPG66PtHd9K8l0q9avitiaA/KUrY7DE52hD4yWY+8z1',
  :password   => 'password'

(I specified the IP address for my desktop. The app is running on my linux dev server at .2.3)

I went to /rack_bug/bookmarklet.html and dragged the "Toggle Rack::Bug" bookmarklet to my Firefox bookmark toolbar. I loaded a page on my Rails App, clicked the "Toggle Rack::Bug" bookmarklet, typed in the password in the popup box, clicked OK, and the page was reloaded - but with no Rack-Bug panels.

Not sure why it's not working, and there's no irc channel or google group for it.

UPDATE: And the fun keeps on leaving. Still no progress on loading the panels from Firefox on my windows desktop. However, I fired up Firefox on my linux dev server, grabbed the bookmarklet, then went to the home page of my app and clicked on it. Filled in the password, and when it reloaded, got a 500 error. Here are the first four lines from the log output:

Status: 500 Internal Server Error
undefined method `length' for #<Pathname:/home/ofer/src/ssp3>
  /usr/lib/ruby/gems/1.8/gems/ruby-openid-2.1.7/lib/openid/extras.rb:3:in `starts_with?'
  /home/ofer/src/ssp3/vendor/plugins/rack-bug/lib/rack/bug/panels/sql_panel/query.rb:65:in `filtered_backtrace'

So, I still haven't fixed the first problem, and now I've discovered a second which will still be around even if I fix the first problem. The second error seems to imply that Firefox on the dev server was actually loading the panel when the error hit, which apparently is in the ruby-openid internals.

I feel even more set back than before.

A: 

I had the same problem and after fiddling around a bit found that you should reload the page without using the browser cache (i.e. press Ctrl-F5)

mikezter
it didn't work :(
odigity
A: 

Is your Linux development server on the same subnet as your desktop? If it isn't then you need to specify your desktop's IP address as it appears to the server. For example my desktop's IP address is 192.X.X.X but from my production server it appears as 84.X.X.X because it's routed through my ISP's gateway.

John Topley
Same subnet. Just me, my windows desktop, and my linux dev server in my living room on the same switch. As proof, here's a snippet of log output from my Rails app: Processing HomeController#index (for 192.168.2.2 at 2010-02-09 10:00:29) [GET]
odigity
+1  A: 

My guess: http://github.com/SamSaffron/rack-bug/commit/16daa41b0ac9513e2d0a2b09ad9941fcb9c5d189

Had the same problem so I wrote that patch, I'll do a pull request

Sam Saffron
That worked! The panels now appear in Firefox on my linux dev server. (Now I just have to figure out why they won't on my windows desktop.)Thanks so much for that. It was probably an obvious fix, but I just don't have the confidence yet to muck around in 3rd party library code.
odigity
You inspired me to take a shot. I just spent an hour mucking around in lib/rack/bug/options.rb|toolbar.rb, the two relevant files. I managed to confirm that the ip_masks values I set in the config files are *not* in fact getting set and used correctly. However, I still couldn't really nail down what the bug was, because I'm still pretty new to ruby and it's kind of confusing. In toolbar.rb, lines 90-92, it tests the request ip against the masks and only ever uses the default values (127.0.0.1). Ref: http://github.com/brynary/rack-bug/blob/master/lib/rack/bug/toolbar.rb
odigity
Forgot to mention - I didn't want to just be stuck, so I compromised by adding my ip address to the default values in options.rb, and now the toolbar loads for me. It's a terrible hack, but at least I can work for now until the bug is fixed in github.
odigity
@odigity, I decides to just run this in development only and I yanked out all the security measures for mysql explain stuff and the host checking. I would be terrified running something like this in production. too many things can go wrong its too rough.
Sam Saffron