mjc-gh / batsd-dash

Sinatra-based dash app for batsd
49 stars 11 forks source link

Running batsd-dash inside another sinatra app #19

Open tc opened 12 years ago

tc commented 12 years ago

I'm trying to run batsd-dash inside another sinatra app with little success.

When i run it locally, it "kinda" works with this:

app = Rack::Builder.new {

  map "/metrics" do
    run BatsdDash::App
  end

  map "/" do
    run App::Web
  end
}.to_app

run Rack::Cascade.new([ app ])

I can hit /metrics but the css assets are referenced incorrectly.

If i try to run it in nginx/passenger 3.0.17 on a server, i get a 502 with:

[ pid=29835 thr=68494850 file=utils.rb:176 time=2012-10-26 21:44:09.504 ]: *** Exception NoMethodError in application (undefined method `call' for nil:NilClass) (process 29835, thread #<Thread:0x82a4c04>):
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-fiber_pool-0.9.2/lib/rack/fiber_pool.rb:24:in `rescue in block in call'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-fiber_pool-0.9.2/lib/rack/fiber_pool.rb:20:in `block in call'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-fiber_pool-0.9.2/lib/fiber_pool.rb:48:in `call'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-fiber_pool-0.9.2/lib/fiber_pool.rb:48:in `block (3 levels) in initialize'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-fiber_pool-0.9.2/lib/fiber_pool.rb:47:in `loop'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-fiber_pool-0.9.2/lib/fiber_pool.rb:47:in `block (2 levels) in initialize'
mjc-gh commented 12 years ago

Interesting. We haven't tried this on our end.

We're actually just starting a bit of rewrite on the app. The plan is to simplify things by just using pure Threads then recommend people use either JRuby or Rubinius (same story for batsd itself).

Not sure when we'll have this ready but hopefully in a week or two we can ship the rewrite.