Flowdock
method

activate_drb

Importance_2
v1.2.6 - Show latest stable - 0 notes - Class: Breakpoint
activate_drb(uri = nil, allowed_hosts = ['localhost', '127.0.0.1', '::1'], ignore_collisions = false) public

Will run Breakpoint in DRb mode. This will spawn a server that can be attached to via the breakpoint-client command whenever a breakpoint is executed. This is useful when you are debugging CGI applications or other applications where you can’t access debug sessions via the standard input and output of your application.

You can specify an URI where the DRb server will run at. This way you can specify the port the server runs on. The default URI is druby://localhost:42531.

Please note that breakpoints will be skipped silently in case the DRb server can not spawned. (This can happen if the port is already used by another instance of your application on CGI or another application.)

Also note that by default this will only allow access from localhost. You can however specify a list of allowed hosts or nil (to allow access from everywhere). But that will still not protect you from somebody reading the data as it goes through the net.

A good approach for getting security and remote access is setting up an SSH tunnel between the DRb service and the client. This is usually done like this:

$ ssh -L20000:127.0.0.1:20000 -R10000:127.0.0.1:10000 example.com (This will connect port 20000 at the client side to port 20000 at the server side, and port 10000 at the server side to port 10000 at the client side.)

After that do this on the server side: (the code being debugged) Breakpoint.activate_drb("druby://127.0.0.1:20000", "localhost")

And at the client side: ruby breakpoint_client.rb -c druby://127.0.0.1:10000 -s druby://127.0.0.1:20000

Running through such a SSH proxy will also let you use breakpoint.rb in case you are behind a firewall.

Detailed information about running DRb through firewalls is available at http://www.rubygarden.org/ruby?DrbTutorial

Show source
Register or log in to add new notes.