set up the API before running the server

Adds support to run setup tasks before the server actually starts and accepts connections. In our case that was starting up the NewRelic agent etc.

Note that while these setup scripts could be run in the app.rb file as well that could sometimes cause problems as when run in demonized mode, the server will run in a different process than the app.rb files itself which can sometimes cause problems (e.g. in the case of NewRelic it would start the NewRelic agent in the process that is exited when the server process is forked later).