Skip to content

Commit 85ea317

Browse files
authored
Merge pull request #1379 from indentlabs/sidekiq-upgrade
Upgrade sidekiq 5 -> 7
2 parents 6ae9a5a + 0a7fdbf commit 85ea317

File tree

4 files changed

+39
-16
lines changed

4 files changed

+39
-16
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ gem 'word_count_analyzer'
100100
gem 'will_paginate', '~> 4.0'
101101

102102
# Workers
103-
gem 'sidekiq', '~> 5.2.7'
104-
gem 'redis', '~> 4.8.1'
103+
gem 'sidekiq', '~> 7.3.9'
104+
gem 'redis', '~> 5.1.0'
105105

106106
# Exports
107107
gem 'csv'

Gemfile.lock

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,9 +2050,6 @@ GEM
20502050
rack (2.2.13)
20512051
rack-mini-profiler (3.3.1)
20522052
rack (>= 1.2.0)
2053-
rack-protection (3.2.0)
2054-
base64 (>= 0.1.0)
2055-
rack (~> 2.2, >= 2.2.4)
20562053
rack-proxy (0.7.7)
20572054
rack
20582055
rack-test (2.2.0)
@@ -2112,7 +2109,10 @@ GEM
21122109
railties (>= 3.2)
21132110
tilt
21142111
redcarpet (3.6.1)
2115-
redis (4.8.1)
2112+
redis (5.1.0)
2113+
redis-client (>= 0.17.0)
2114+
redis-client (0.24.0)
2115+
connection_pool
21162116
responders (3.1.1)
21172117
actionpack (>= 5.2)
21182118
railties (>= 5.2)
@@ -2158,11 +2158,12 @@ GEM
21582158
sentry-ruby (5.23.0)
21592159
bigdecimal
21602160
concurrent-ruby (~> 1.0, >= 1.0.2)
2161-
sidekiq (5.2.7)
2162-
connection_pool (~> 2.2, >= 2.2.2)
2163-
rack (>= 1.5.0)
2164-
rack-protection (>= 1.5.0)
2165-
redis (>= 3.3.5, < 5)
2161+
sidekiq (7.3.9)
2162+
base64
2163+
connection_pool (>= 2.3.0)
2164+
logger
2165+
rack (>= 2.2.4)
2166+
redis-client (>= 0.22.2)
21662167
simplecov (0.13.0)
21672168
docile (~> 1.1.0)
21682169
json (>= 1.8, < 3)
@@ -2296,14 +2297,14 @@ DEPENDENCIES
22962297
rails_admin
22972298
react-rails
22982299
redcarpet
2299-
redis (~> 4.8.1)
2300+
redis (~> 5.1.0)
23002301
rmagick
23012302
sass-rails
23022303
selenium-webdriver
23032304
sentry-rails
23042305
sentry-ruby
23052306
serendipitous!
2306-
sidekiq (~> 5.2.7)
2307+
sidekiq (~> 7.3.9)
23072308
slack-notifier
23082309
spring
23092310
sprockets (~> 4.2.0)

config/initializers/sidekiq.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Sidekiq configuration for version 7+
2+
Sidekiq.configure_server do |config|
3+
config.redis = { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') }
4+
end
5+
6+
Sidekiq.configure_client do |config|
7+
config.redis = { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') }
8+
end
9+
10+
# Sidekiq Web UI setup
11+
require 'sidekiq/web'
12+
13+
# Configure Web UI
14+
Sidekiq::Web.app_url = '/' # Set the app URL for navigation

config/routes.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,18 @@
452452

453453
mount StripeEvent::Engine, at: '/webhooks/stripe'
454454

455+
# Sidekiq Web UI with authentication for v7+
455456
require 'sidekiq/web'
456-
authenticate :user, lambda { |u| u.site_administrator? } do
457-
mount Sidekiq::Web => '/sidekiq'
458-
end
457+
458+
# Use Devise authentication constraint
459+
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
460+
# Protect with simple authentication until we can fix proper user-based auth
461+
# This is a temporary solution until we update the authentication to use ActiveSupport::SecurityUtils
462+
ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest(ENV['SIDEKIQ_USERNAME'] || 'admin')) &
463+
ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest(ENV['SIDEKIQ_PASSWORD'] || 'password'))
464+
end unless Rails.env.development?
465+
466+
mount Sidekiq::Web => '/sidekiq'
459467

460468
# Promos and other temporary pages
461469
get '/redeem/infostack', to: 'main#infostack'

0 commit comments

Comments
 (0)