GithubHelp home page GithubHelp logo

jankeesvw / delayed_job_web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ejschmitt/delayed_job_web

0.0 0.0 0.0 683 KB

Resque like web interface for delayed job

License: MIT License

Ruby 34.77% JavaScript 19.78% CSS 19.26% HTML 26.19%

delayed_job_web's Introduction

delayed_job_web

A resque inspired (read: stolen) interface for delayed_job. This gem is written to work with rails 3 and 4 applications using activerecord.

Some features:

  • Easily view enqueued, working, pending, and failed jobs.
  • Queue any single job or all pending jobs to run immediately.
  • Remove a failed job or easily remove all failed jobs.
  • Watch delayed_job operation with live ajax polling.
  • Filter delayed_jobs by queue names (comma separated values in the input filter).
  • Reset all queue filters by clicking the reset button.

The interface (yeah, a ripoff of resque-web):

Screen shot

Quick Start For Rails 3 and 4 Applications

Add the dependency to your Gemfile

gem "delayed_job_web"

Install it...

bundle

Add the following route to your application for accessing the interface, and retrying failed jobs.

match "/delayed_job" => DelayedJobWeb, :anchor => false, :via => [:get, :post]

You probably want to password protect the interface, an easy way is to add something like this your config.ru file

if Rails.env.production?
  DelayedJobWeb.use Rack::Auth::Basic do |username, password|
    ActiveSupport::SecurityUtils.variable_size_secure_compare('username', username) &&
      ActiveSupport::SecurityUtils.variable_size_secure_compare('password', password)
  end
end

delayed_job_web runs as a Sinatra application within the rails application. Visit it at /delayed_job.

Authenticating with Devise and Warden

This can be accomplished in the routes.rb file using an authenticated callback. Note, do not use an authenticate callback as this forces an authentication check and redirects can be screwy, see here for more information.

A simple user check looks like this:

authenticated :user do
  mount DelayedJobWeb, at: "/delayed_job"
end

But you probably want to check for administrator permissions:

authenticated :user, -> user { user.admin? }  do
  mount DelayedJobWeb, at: "/delayed_job"
end

Serving static assets

If you mount the app on another route, you may encounter the CSS not working anymore. To work around this you can leverage a special HTTP header. Install it, activate it and configure it -- see below.

Apache

XSendFile On
XSendFilePath /path/to/shared/bundle

XSendFilePath white-lists a directory from which static files are allowed to be served. This should be at least the path to where delayed_job_web is installed.

Using Rails you'll have to set config.action_dispatch.x_sendfile_header = "X-Sendfile".

Nginx

Nginx uses an equivalent that's called X-Accel-Redirect, further instructions can be found in their wiki.

Rails' will need to be configured to config.action_dispatch.x_sendfile_header = "X-Accel-Redirect".

Lighttpd

Lighty is more X-Sendfile, like outlined in their wiki.

Configuration

The following settings can be changed using the .set method in your configu.ru. For example:

DelayedJobWeb.set(:allow_requeue_pending, false)
  • allow_requeue_pending (default: true)

    Controls whether the 'Enqueue all immediately' button is available on the list of Pending jobs. Hiding this button can be useful if you have jobs set to run in the future and you don't want to accidentally run them immediately.

Contributing

  1. Fork
  2. Hack
  3. rake test
  4. Send a pull request

Releasing a new version

  1. Update the version in delayed_job_web.gemspec

  2. git commit delayed_job_web.gemspec with the following message format:

     Version x.x.x
    
     Changelog:
     * Some new feature
     * Some new bug fix
    
  3. rake release

Author

Erick Schmitt - @ejschmitt

Maintained by Andy Atkinson - @andatki

Get in touch if you'd like to take over maintenance!

delayed_job_web's People

Contributors

akatz avatar andyatkinson avatar bethesque avatar botandrose-machine avatar chrismear avatar dholdren avatar diasks2 avatar ejschmitt avatar emmn avatar ferlatte avatar glaszig avatar hidenba avatar jkraemer avatar manjunath-nm89 avatar mberube avatar mbobin avatar milushov avatar nicolas-simplex avatar rathboma avatar scalp42 avatar toolmantim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.