resque: Resque fails to load assets when run on Rails 3.1

Hi, I’ve added

mount Resque::Server, :at => '/resque-admin'

to my routes.rb, it works nice on development, but fails to load images/stylesheets/javascripts on production and when (via view source) I click on https://…/resque-admin/reset.css it shows weird Routing error with message:

No route matches [GET] “/opt/ruby-enterprise-1.8.7-2010.03/lib/ruby/gems/1.8/gems/resque-1.19.0/lib/resque/server/public/reset.css”

I know that Rails 3.1 has asset pipeline, but since this is standalone sinatra app it shouldn’t matter, right? Is it my fault or whats going on? Any hints welcome 😃

Env: Ruby EE 2010.03 Resque 1.19.0 Rails 3.1.0

production.rb:

  config.serve_static_assets = false
  config.assets.digest = true

About this issue

  • Original URL
  • State: closed
  • Created 13 years ago
  • Comments: 52 (7 by maintainers)

Most upvoted comments

I went back over this and kind of sidestepped it in nginx with the following:

  location ~ ^/(img|js|css|font|static)/ {
    add_header Cache-Control public;
    access_log off;
    expires 30d;
  }

IOW, taking resque out of the equation for nginx asset configuration. It’s an improvement, in that it avoids maintenance issues should resque update its web assets, since the gem assets are used with this configuration.

The problem is that resque’s assets and “pages” are being served from the same directory, which makes configuring this case a little tricky. If you add resque to the list of directories in location above, then resque 404s, because nginx can’t find the “file”, say http://example.com/resque/queues.

Above, @mtoledo says:

The solution is to have a separate location clause that matches the
resque-server mountpoint and sets the root/alias etc appropriately
for the path of those files.

Well, I tried that, but every incantation I tried failed to work. I tried, such as:

  location  ^~ /resque/ {
    root /path/to/resque/server/public
  }

So, could someone provide a nginx location clause that works, please.

It would be great to have a wiki page for these correct/suggested configuration.