From bf203766679eab351dbe4e95a99db526958a3d46 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Thu, 4 Apr 2019 15:40:28 +0200 Subject: [PATCH] Add Delayed Job Web for superadmins only This adds https://github.com/ejschmitt/delayed_job_web to enable async job management such as retries, removal of failed jobs, etc. Only superadmins can access this web UI though. Therefore any sysadmin that needs to use it should have access to the appropriate instance superadmin credentials in Bitwarden. --- Gemfile | 1 + Gemfile.lock | 12 ++++++++++++ config/routes/admin.rb | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/Gemfile b/Gemfile index 374f59ac6a..9232a45e47 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,7 @@ gem 'jwt', '~> 2.1' gem 'delayed_job_active_record' gem 'daemons' +gem 'delayed_job_web' # Fix bug in simple_form preventing collection_check_boxes usage within form_for block # When merged, revert to upstream gem diff --git a/Gemfile.lock b/Gemfile.lock index d2498638ed..48fe062c13 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -277,6 +277,11 @@ GEM delayed_job_active_record (4.1.3) activerecord (>= 3.0, < 5.3) delayed_job (>= 3.0, < 5) + delayed_job_web (1.4.3) + activerecord (> 3.0.0) + delayed_job (> 2.0.3) + rack-protection (>= 1.5.5) + sinatra (>= 1.4.4) devise (2.2.8) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) @@ -599,6 +604,8 @@ GEM rack (>= 0.4) rack-mini-profiler (0.10.7) rack (>= 1.2.0) + rack-protection (1.5.5) + rack rack-rewrite (1.5.1) rack-ssl (1.3.4) rack @@ -710,6 +717,10 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) + sinatra (1.4.6) + rack (~> 1.4) + rack-protection (~> 1.4) + tilt (>= 1.3, < 3) skylight (1.7.2) activesupport (>= 3.0.0) spinjs-rails (1.4) @@ -802,6 +813,7 @@ DEPENDENCIES debugger-linecache deface! delayed_job_active_record + delayed_job_web diffy eventmachine (>= 1.2.3) factory_bot_rails diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 1f55f8d154..f79a3eb742 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -1,5 +1,10 @@ Openfoodnetwork::Application.routes.draw do namespace :admin do + + authenticated :spree_user, -> user { user.has_spree_role?('admin') } do + mount DelayedJobWeb, at: '/delayed_job' + end + resources :bulk_line_items resources :order_cycles do