Search code examples
ruby-on-railsredissidekiq

Running Redmon and Sidekiq within Rails?


I should preface this by saying that I suspect it's a silly question stemming from a schoolboy-grade misunderstanding of how Rails and Sidekiq fit together, but some aggressive Googling and tinkering haven't turned up a whole lot of answers and so I thought I'd give this a shot.

I'm trying to get Redmon to integrate with a Rails thing that I'm putting together; in particular, I'm trying to get it to play nice with Sidekiq. The README provides a sample Sidekiq worker configuration, which is keen, but what I can't figure out is how or where to invoke it. I'd like the Redmon process to start running in the background either when Rails is loaded or when I navigate to http://foo.br/redmon. Most of the Sidekiq documentation I've read is about invoking a worker from within a controller, which would be fine, except that it seems a little silly to implement a controller that just launches Redmon and redirects me.

Most of my time with Sidekiq, I've had CarrierWave as a mediator and haven't had to bother with the nitty-gritty; without that, I'm a little lost. I'd be super-duper-grateful for any suggestions that anyone has.


Solution

  • Redmon shouldn't run through sidekiq or know about Sidekiq. Redmon is a Sinatra application that will either run stand-alone or be mounted inside your rails application.

    Once you have the Redmon gem installed, you can mount the Redmon application in your Rails app by editing config/routes.rb:

    mount Redmon::App => '/redmon'