diff --git a/Gemfile b/Gemfile index 8a5b728..6d0b53d 100644 --- a/Gemfile +++ b/Gemfile @@ -21,15 +21,22 @@ gem 'jbuilder', '~> 2.7' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.2', require: false +# Configuration gem 'dotenv-rails' +# Authentication gem 'warden' gem 'devise' gem 'devise_ldap_authenticatable' gem 'net-ldap' +# HTTP requests gem 'faraday' +# Background/scheduled jobs +gem 'sidekiq' +gem 'sidekiq-scheduler' + group :development, :test do # Use sqlite3 as the database for Active Record gem 'sqlite3', '~> 1.4' diff --git a/Gemfile.lock b/Gemfile.lock index 922b81a..6a4c8c2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,6 +73,7 @@ GEM regexp_parser (~> 1.5) xpath (~> 3.2) concurrent-ruby (1.1.7) + connection_pool (2.2.3) crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.6) @@ -91,7 +92,10 @@ GEM dotenv-rails (2.7.2) dotenv (= 2.7.2) railties (>= 3.2, < 6.1) + e2mmap (0.1.0) erubi (1.9.0) + et-orbi (1.2.4) + tzinfo factory_bot (6.1.0) activesupport (>= 5.0.0) factory_bot_rails (6.1.0) @@ -100,6 +104,9 @@ GEM faraday (0.17.0) multipart-post (>= 1.2, < 3) ffi (1.13.1) + fugit (1.4.2) + et-orbi (~> 1.1, >= 1.1.8) + raabro (~> 1.4) globalid (0.4.2) activesupport (>= 4.2.0) hashdiff (0.4.0) @@ -141,6 +148,7 @@ GEM public_suffix (4.0.6) puma (4.3.6) nio4r (~> 2.0) + raabro (1.4.0) rack (2.2.3) rack-proxy (0.6.5) rack @@ -176,6 +184,7 @@ GEM rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) + redis (4.2.5) regexp_parser (1.8.2) responders (3.0.1) actionpack (>= 5.0) @@ -197,6 +206,8 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.10.0) + rufus-scheduler (3.7.0) + fugit (~> 1.1, >= 1.1.6) safe_yaml (1.0.5) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -208,6 +219,17 @@ GEM sprockets (> 3.0) sprockets-rails tilt + sidekiq (6.1.3) + connection_pool (>= 2.2.2) + rack (~> 2.0) + redis (>= 4.2.0) + sidekiq-scheduler (3.0.1) + e2mmap + redis (>= 3, < 5) + rufus-scheduler (~> 3.2) + sidekiq (>= 3) + thwait + tilt (>= 1.4.0) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) @@ -222,6 +244,8 @@ GEM sqlite3 (1.4.2) thor (1.0.1) thread_safe (0.3.6) + thwait (0.2.0) + e2mmap tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) @@ -274,6 +298,8 @@ DEPENDENCIES rails (~> 6.0.3, >= 6.0.3.4) rspec-rails sass-rails (>= 6) + sidekiq + sidekiq-scheduler spring spring-watcher-listen (~> 2.0.0) sqlite3 (~> 1.4) diff --git a/config/application.rb b/config/application.rb index 127cf2f..263387b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -39,5 +39,7 @@ module Akkounts g.fixture_replacement :factory_bot, suffix_factory: 'factory', dir: 'spec/factories' g.stylesheets false end + + config.active_job.queue_adapter = :sidekiq end end diff --git a/config/routes.rb b/config/routes.rb index ae5bdc1..2a3592d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +require 'sidekiq/web' + Rails.application.routes.draw do resources :donations devise_for :users @@ -23,6 +25,10 @@ Rails.application.routes.draw do resources :donations end + authenticate :user, ->(user) { user.is_admin? } do + mount Sidekiq::Web => '/sidekiq' + end + # Letter Opener (open "sent" emails in dev and staging) if Rails.env.match(/staging|development/) mount LetterOpenerWeb::Engine, at: "letter_opener" diff --git a/config/sidekiq.yml b/config/sidekiq.yml new file mode 100644 index 0000000..615bb16 --- /dev/null +++ b/config/sidekiq.yml @@ -0,0 +1,3 @@ +:concurrency: 2 +:queues: + - default