Pergunta

I’ve got a Sinatra web app. I’m using Resque and Resque Scheduler, and now I’m looking into adding Resque Web to (hopefully) see what my Resque queue looks like. Now here’s my problem: the official Resque Web is a Rails app. I don’t know how to use a Rails app inside of Sinatra, or if it’s even possible.

So my question: What’s the best way to implement Resque Web into my Sinatra app? Can I use the rails app inside of Sinatra? I saw one person say that you should have a separate part of your app running Rails, but that seems really nasty. Is there a better way to do it?

Thanks!

Foi útil?

Solução 2

Here’s what I was looking for: http://asciicasts.com/episodes/271-resque

Resque-web can be stand alone, run from the command line. So I’m just starting it up with a shell command whenever I spin up an instance of my server. Not exactly what I was looking for, but it does the trick!

Thanks for the suggestions, all.

Outras dicas

I've not used the ResqueWeb, but Rails and Sinatra are both Rack compliant frameworks, so they should be able to run each other or alongside.

http://www.sinatrarb.com/intro.html#Rack%20Middleware

## my-amazing-app.rb
use MySlightlyLessAmazingRailsApp
# rest of Sinatra stuff…

or

# config.ru
map "/" do
  # easiest to mount Sinatra apps this way if using the modular style
  run MyAmazingSinatraApp
end

map "/resque" do
  run MySlightlyLessAmazingRailsApp
end

I don't know how you'd do this with Rails, perhaps try this link http://m.onkey.org/rails-meets-sinatra or perhaps this:

RailsApp::Application.routes.draw do
  mount MyAmazingApp, :at => "/more-amazed"
  # rest of the rails routes
end
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top