From e25e314612161b06512b4ce79667a855089b0bc9 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Wed, 18 Oct 2023 13:12:06 -0500 Subject: [PATCH 1/4] Sidekiq: prioritize the GBL Admin priority queue Fixes #543 --- Gemfile | 2 +- Gemfile.lock | 76 ++++++++++++++++-------------- Procfile | 2 +- config/environments/development.rb | 2 +- config/routes.rb | 2 +- config/sidekiq.yml | 5 ++ 6 files changed, 50 insertions(+), 39 deletions(-) diff --git a/Gemfile b/Gemfile index 56878034f..b76c43a61 100644 --- a/Gemfile +++ b/Gemfile @@ -80,7 +80,7 @@ gem 'bootstrap', '~> 4.0' gem 'popper_js' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' gem 'geoblacklight', '~> 4.1' -gem 'geoblacklight_admin', '~> 0.3' +gem 'geoblacklight_admin', git: "https://github.com/geobtaa/geoblacklight_admin.git", branch: "feature/#22-queue-priorities" gem "rubyzip", ">= 1.3.0" gem "awesome_print" diff --git a/Gemfile.lock b/Gemfile.lock index aed6c10f9..6ed6fa702 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,6 +39,42 @@ GIT rails (>= 5.2, < 7.1) statesman (~> 10.0.0) +GIT + remote: https://github.com/geobtaa/geoblacklight_admin.git + revision: 11e2af5cb545484cf9db3107a929b75bb3589d49 + branch: feature/#22-queue-priorities + specs: + geoblacklight_admin (0.3.0) + active_storage_validations (~> 1.0) + amazing_print + blacklight (~> 7.33) + blacklight_advanced_search + blacklight_range_limit + bootstrap (~> 4.0) + chosen-rails (~> 1.10) + cocoon (~> 1.2) + config (~> 4.0) + devise (~> 4.7) + devise-bootstrap-views (~> 1.0) + devise_invitable (~> 2.0) + dotenv-rails (~> 2.8) + geoblacklight (~> 4.0) + haml (~> 5.2) + httparty (~> 0.21) + inline_svg (~> 1.9) + jquery-rails (~> 4.4) + kithe (~> 2.0) + noticed (~> 1.6) + pagy (~> 6.0) + paper_trail (~> 14.0) + pg (~> 1.4) + qa (~> 5.0) + rails (>= 6.1, < 7.1) + ruby-progressbar + simple_form (~> 5.0) + sprockets (< 4) + statesman (~> 10.0) + GEM remote: https://rubygems.org/ specs: @@ -328,36 +364,6 @@ GEM mime-types rails (>= 6.1, < 7.1) rgeo-geojson - geoblacklight_admin (0.3.0) - active_storage_validations (~> 1.0) - amazing_print - blacklight (~> 7.33) - blacklight_advanced_search - blacklight_range_limit - bootstrap (~> 4.0) - chosen-rails (~> 1.10) - cocoon (~> 1.2) - config (~> 4.0) - devise (~> 4.7) - devise-bootstrap-views (~> 1.0) - devise_invitable (~> 2.0) - dotenv-rails (~> 2.8) - geoblacklight (~> 4.0) - haml (~> 5.2) - httparty (~> 0.21) - inline_svg (~> 1.9) - jquery-rails (~> 4.4) - kithe (~> 2.0) - noticed (~> 1.6) - pagy (~> 6.0) - paper_trail (~> 14.0) - pg (~> 1.4) - qa (~> 5.0) - rails (>= 6.1, < 7.1) - ruby-progressbar - simple_form (~> 5.0) - sprockets (< 4) - statesman (~> 10.0) geocoder (1.8.2) git (1.11.0) rchardet (~> 1.8) @@ -446,7 +452,7 @@ GEM llhttp-ffi (0.3.1) ffi-compiler (~> 1.0) rake (~> 13.0) - loofah (2.21.3) + loofah (2.21.4) crass (~> 1.0.2) nokogiri (>= 1.12.0) m (1.5.1) @@ -489,7 +495,7 @@ GEM multi_xml (0.6.0) net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.4.0) + net-imap (0.4.1) date net-protocol net-pop (0.1.2) @@ -591,7 +597,7 @@ GEM regexp_parser (2.8.1) request_store (1.5.1) rack (>= 1.4) - responders (3.1.0) + responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) retriable (3.1.2) @@ -667,7 +673,7 @@ GEM redis (>= 4.5.0, < 5) sidekiq-failures (1.0.4) sidekiq (>= 4.0.0) - simple_form (5.2.0) + simple_form (5.3.0) actionpack (>= 5.2) activemodel (>= 5.2) sitemap_generator (6.0.2) @@ -791,7 +797,7 @@ DEPENDENCIES foreman geoblacklight (~> 4.1) geoblacklight-icons! - geoblacklight_admin (~> 0.3) + geoblacklight_admin! geoblacklight_sidecar_images! haml handlebars_assets (~> 0.23.0) diff --git a/Procfile b/Procfile index bb9953eee..56a68d410 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -sidekiq: bundle exec sidekiq -q devise,1 -q default +sidekiq: bundle exec sidekiq -q priority,2 -q devise,1 -q default sidekiq_web: bundle exec puma sidekiq.ru diff --git a/config/environments/development.rb b/config/environments/development.rb index 71294e150..f72343189 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -71,7 +71,7 @@ # Google Analytics - Dev config.google_analytics = 'UA-82483267-2' - config.active_job.queue_adapter = :inline + config.active_job.queue_adapter = :sidekiq # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true diff --git a/config/routes.rb b/config/routes.rb index 0c92d6f38..ef41338e2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ get 'robots.:format' => 'robots#robots' # Sidekiq - Uncomment and restart app to view sidekiq dashboard - # mount Sidekiq::Web => "/sidekiq" + mount Sidekiq::Web => "/sidekiq" # Feedback mount PointlessFeedback::Engine, :at => '/feedback' diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 5dcb81cbc..7617e3415 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -1,2 +1,7 @@ :concurrency: 3 :max_retries: 1 + +:queues: + - [priority, 2] + - [devise, 1] + - default \ No newline at end of file From c202aa35cc7c8292f4a27b8c7354726fd901b84c Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Wed, 18 Oct 2023 13:36:16 -0500 Subject: [PATCH 2/4] Sidekiq config: always process all jobs in this queue order priority jobs > devise > default All priority jobs will be worked on until they are done, before devise, and before default jobs. --- Procfile | 2 +- config/sidekiq.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Procfile b/Procfile index 56a68d410..ac275ecdd 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -sidekiq: bundle exec sidekiq -q priority,2 -q devise,1 -q default +sidekiq: bundle exec sidekiq -q priority -q devise -q default sidekiq_web: bundle exec puma sidekiq.ru diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 7617e3415..ffa0268f4 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -2,6 +2,6 @@ :max_retries: 1 :queues: - - [priority, 2] - - [devise, 1] + - priority + - devise - default \ No newline at end of file From 832969192580a166ac03330119d3bcf45ea4a5ae Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Wed, 18 Oct 2023 13:43:08 -0500 Subject: [PATCH 3/4] Update routes.rb Force auth for sidekiq web ui and move within /admin --- config/routes.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index ef41338e2..eb5c99bb1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,9 +3,6 @@ get 'help', :to => redirect('https://sites.google.com/umn.edu/btaa-gdp/help') get 'robots.:format' => 'robots#robots' - # Sidekiq - Uncomment and restart app to view sidekiq dashboard - mount Sidekiq::Web => "/sidekiq" - # Feedback mount PointlessFeedback::Engine, :at => '/feedback' @@ -99,6 +96,11 @@ end namespace :admin do + + authenticate :user, ->(user) { user.admin? } do + mount Sidekiq::Web => "/sidekiq" + end + devise_for :users, controllers: {invitations: "devise/invitations"}, skip: [:registrations] # Root root to: "documents#index" From 36588bc58303bd5a78297c3c5b39e5387f7a9dc9 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Wed, 18 Oct 2023 14:21:20 -0500 Subject: [PATCH 4/4] Gems: bump GBL Admin to latest --- Gemfile | 2 +- Gemfile.lock | 70 ++++++++++++++++++++++++---------------------------- 2 files changed, 33 insertions(+), 39 deletions(-) diff --git a/Gemfile b/Gemfile index b76c43a61..56878034f 100644 --- a/Gemfile +++ b/Gemfile @@ -80,7 +80,7 @@ gem 'bootstrap', '~> 4.0' gem 'popper_js' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' gem 'geoblacklight', '~> 4.1' -gem 'geoblacklight_admin', git: "https://github.com/geobtaa/geoblacklight_admin.git", branch: "feature/#22-queue-priorities" +gem 'geoblacklight_admin', '~> 0.3' gem "rubyzip", ">= 1.3.0" gem "awesome_print" diff --git a/Gemfile.lock b/Gemfile.lock index 6ed6fa702..84547000a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,42 +39,6 @@ GIT rails (>= 5.2, < 7.1) statesman (~> 10.0.0) -GIT - remote: https://github.com/geobtaa/geoblacklight_admin.git - revision: 11e2af5cb545484cf9db3107a929b75bb3589d49 - branch: feature/#22-queue-priorities - specs: - geoblacklight_admin (0.3.0) - active_storage_validations (~> 1.0) - amazing_print - blacklight (~> 7.33) - blacklight_advanced_search - blacklight_range_limit - bootstrap (~> 4.0) - chosen-rails (~> 1.10) - cocoon (~> 1.2) - config (~> 4.0) - devise (~> 4.7) - devise-bootstrap-views (~> 1.0) - devise_invitable (~> 2.0) - dotenv-rails (~> 2.8) - geoblacklight (~> 4.0) - haml (~> 5.2) - httparty (~> 0.21) - inline_svg (~> 1.9) - jquery-rails (~> 4.4) - kithe (~> 2.0) - noticed (~> 1.6) - pagy (~> 6.0) - paper_trail (~> 14.0) - pg (~> 1.4) - qa (~> 5.0) - rails (>= 6.1, < 7.1) - ruby-progressbar - simple_form (~> 5.0) - sprockets (< 4) - statesman (~> 10.0) - GEM remote: https://rubygems.org/ specs: @@ -364,6 +328,36 @@ GEM mime-types rails (>= 6.1, < 7.1) rgeo-geojson + geoblacklight_admin (0.3.1) + active_storage_validations (~> 1.0) + amazing_print + blacklight (~> 7.33) + blacklight_advanced_search + blacklight_range_limit + bootstrap (~> 4.0) + chosen-rails (~> 1.10) + cocoon (~> 1.2) + config (~> 4.0) + devise (~> 4.7) + devise-bootstrap-views (~> 1.0) + devise_invitable (~> 2.0) + dotenv-rails (~> 2.8) + geoblacklight (~> 4.0) + haml (~> 5.2) + httparty (~> 0.21) + inline_svg (~> 1.9) + jquery-rails (~> 4.4) + kithe (~> 2.0) + noticed (~> 1.6) + pagy (~> 6.0) + paper_trail (~> 14.0) + pg (~> 1.4) + qa (~> 5.0) + rails (>= 6.1, < 7.1) + ruby-progressbar + simple_form (~> 5.0) + sprockets (< 4) + statesman (~> 10.0) geocoder (1.8.2) git (1.11.0) rchardet (~> 1.8) @@ -695,7 +689,7 @@ GEM temple (0.10.3) tether-rails (1.4.0) rails (>= 3.1) - thor (1.2.2) + thor (1.3.0) thread_safe (0.3.6) tilt (2.3.0) timeout (0.4.0) @@ -797,7 +791,7 @@ DEPENDENCIES foreman geoblacklight (~> 4.1) geoblacklight-icons! - geoblacklight_admin! + geoblacklight_admin (~> 0.3) geoblacklight_sidecar_images! haml handlebars_assets (~> 0.23.0)