1

Resque/Sidekiq come with a web frontend, which is a Sinatra app.

The way to mount this in a Rails app is to add this to routes (http://railscasts.com/episodes/366-sidekiq?view=asciicast):

mount Sidekiq::Web, at: "/sidekiq"

How do i mount this in a Padrino app? Mapping it in config.ru like other Rack apps does not work

map '/sidekiq' do
  run Sidekiq::Web
end
Sathish
  • 20,660
  • 24
  • 63
  • 71

3 Answers3

2

Padrino uses Padrino.mount which expects apps to respond to dependencies and setup_application. This hack (https://gist.github.com/1718723) allows you to mount a Sinatra application inside a Padrino application

Sathish
  • 20,660
  • 24
  • 63
  • 71
1

Padrino app is a rack app and in config.ru you would see

require ::File.dirname(__FILE__) + '/config/boot.rb'
run Padrino.application

You can change this to use Rack::URLMap

require ::File.dirname(__FILE__) + '/config/boot.rb'
run Rack::URLMap.new("/sidekiq" => Sidekiq::Web.new, "/app" => Padrino.application.new)
irfn
  • 560
  • 3
  • 11
  • This does not work if i use padrino s to start server. URLMap works only if i use rackup to start server. – Sathish Jan 19 '13 at 17:03
0
  1. Add gem 'sidekiq' to Gemfile
  2. bundle install
  3. Add following lines to config/boot.rb

    Padrino.before_load do
      Padrino.dependency_paths << Padrino.root('app/workers/*.rb')
    end
    
  4. Add following lines to config/apps.rb

    require 'sidekiq/web'
    
    Padrino.mount('Sidekiq', app_class: 'Sidekiq::Web', app_root: Sidekiq::Web.root).to('/sidekiq')
    
  5. Create any worker in app/workers/

  6. Run bundle exec sidekiq -r ./config/boot.rb

zires
  • 554
  • 6
  • 16