gemhome / fnordmetric

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

Running on Heroku #17

Open bf4 opened 10 years ago

bf4 commented 10 years ago

Issue by juandazapata Friday May 04, 2012 at 15:49 GMT Originally opened as https://github.com/paulasmuth/fnordmetric/issues/73


I'm having a hard time trying to run Fnordmetric in Heroku. Basically, what happens is that Heroku won't allow to start the EM worker on the same dyno. Is there a way to manually run the Fnordmetric worker using a rake command or something similar?

bf4 commented 10 years ago

Comment by paulasmuth Sunday May 06, 2012 at 23:54 GMT


First of all, sorry for my late answer. From fnordmetric v0.7.3 upwards you can do the following:

$ ruby my_fnordmetric_app.rb worker
bf4 commented 10 years ago

Comment by fairchild Monday May 07, 2012 at 01:33 GMT


This seems to work fine when you have FnordMetric.standalone. However, standalone does not appear to allow you to pass in options. Is there a recommended way to run it with something like

FnordMetric.embedded(
  :redis_url => ENV['REDISTOGO_URL'] || "redis://localhost:6379",
  :inbound_stream => ["0.0.0.0", "1337"]
)

And, any idea how best to set the inbound_stream port on heroku?

bf4 commented 10 years ago

Comment by paulasmuth Monday May 07, 2012 at 01:36 GMT


hm, maybe you are looking for this?

FnordMetric.server_configuration = {
  :redis_url => ENV['REDISTOGO_URL'] || "redis://localhost:6379",
  :inbound_stream => ["0.0.0.0", "1337"]
}

FnordMetric.standalone
bf4 commented 10 years ago

Comment by juandazapata Monday May 07, 2012 at 13:38 GMT


Heroku won't allow to spawn a random port so this line

:inbound_stream => ["0.0.0.0", "1337"]

Will fail in Heroku.

Finally, thank you for your answer and your willingness to help, you're awesome.

bf4 commented 10 years ago

Comment by paulasmuth Monday May 07, 2012 at 14:12 GMT


You can disable the inbound stream by passing:

FnordMetric.server_configuration = {
  :redis_url => ENV['REDISTOGO_URL'] || "redis://localhost:6379",
  :inbound_stream => false
}```
bf4 commented 10 years ago

Comment by fairchild Monday May 07, 2012 at 15:31 GMT


I created a sample repo at https://github.com/fairchild/fnordystats. I think it can likely be done much cleaner than i have done there. Seems when inbound_stream is set to false, i get errors like cant start FnordMetric::InboundStream. port in use?