– we create awesome web applications

Pow is great. The single thing that bothered me was problems with using debugger while pow'ing away.

Did you ever put a debugger into your controller, connected with rdebug, hit refresh but it didn't stop?

The problem is most probably with POW_WORKERS setting. You see, by default, pow will start 2 ruby processes per application.

Since direct console access is not available when using pow, you have to use rdebug instead. Usually it means something like this added to config/environments/development.rb:

# to use ruby debug with Pow do the following:
# echo export RUBY_DEBUG_PORT=20000 >> ./.powenv
# to connect:
# rdebug -c -p PORT_NUMBER
  Debugger.start_remote nil, ENV['RUBY_DEBUG_PORT'].to_i

Then you can restart your pow application and run the following command line:

rdebug -c -p 20000

Once you get "Connected." back you know that your rdebug has connected to some ruby process and is awaiting breakpoint hit.

The problem is that pow by default starts 2 ruby processes per application, and so only one of them will be able to bind to the port 20000. Which in turn means that only requests being processed by this process will get a chance to be stopped in debugger. So on average only about 50% of your requests will hit the debugger.

The solution is fairly simple. Just add the following line to your ~/.powconfig file:

export POW_WORKERS=1

Then restart pow.

Note: I mean the whole pow server, not just your current application. I'm using the excellent powify gem for this:

gem install powify
powify server restart

From now on you will get only one pow process per application and never miss a breakpoint again.