gemhome / fnordmetric

(possible new home for) FnordMetric is a redis/ruby-based realtime Event-Tracking app
0 stars 1 forks source link

Make FnordMetric::Web a true rack app #28

Open bf4 opened 10 years ago

bf4 commented 10 years ago

Issue by KieranP Wednesday Sep 26, 2012 at 10:02 GMT Originally opened as https://github.com/paulasmuth/fnordmetric/issues/98


I'd like to do thin -C fnord.yml fnord.rb to start the server daemonized. The current implementation isn't rackup friendly, so in production, I'm having to start a screen process and run the ruby file in that, which isn't very friendly.

bf4 commented 10 years ago

Comment by skorfmann Friday Jan 18, 2013 at 13:58 GMT


Have you made any progress on this? I'll also have the need of some production environment in a bit and I'm still not sure about the best approach.

bf4 commented 10 years ago

Comment by axsuul Saturday Feb 16, 2013 at 02:49 GMT


Same here.

bf4 commented 10 years ago

Comment by skorfmann Saturday Feb 16, 2013 at 03:01 GMT


Just deployed this stuff using capistrano with a rackup file utilising thin behind ngnix (communicating via unix-sockets) and separate worker processes. Will write about it in more detail once it's completely done and working.

But basically it boils down to this:

Extract the relevant parts from https://github.com/paulasmuth/fnordmetric/blob/master/fnordmetric-core/lib/fnordmetric/web/web.rb to your own config.ru

Wrap your worker processes with something like https://github.com/ghazel/daemons

We are not running acceptors at the moment.

bf4 commented 10 years ago

Comment by benschwarz Wednesday May 22, 2013 at 03:40 GMT


@skorfmann - Care to share your config.ru?

bf4 commented 10 years ago

Comment by skorfmann Wednesday May 22, 2013 at 03:51 GMT


@benschwarz here you go:

#!/usr/bin/env ruby

$: << File.expand_path(File.dirname(__FILE__))

require 'app'

use Rack::CommonLogger
use Rack::ShowExceptions

map "/stream" do
  run FnordMetric::WebSocket.new
end

map "/" do
  run FnordMetric::App.new({})
end

"app.rb" is your custom code for fnordmetric

bf4 commented 10 years ago

Comment by skorfmann Wednesday May 22, 2013 at 03:53 GMT


I've also written about a production deployment of this stuff: http://skorfmann.com/blog/2013/03/25/the-bumpy-road-to-fnordmetric/