Skip to main content

Sidekiq Web UI

Config and Auth

Sidekiq Web UI is loaded via sidekiq/web in routes.rb, included in the sidekiq gem.

Right now we use simple http auth.

Once we get to building out an admins table for the Ops Dashboard (i.e. Portal) for Jod Staff, we can possibly do the following so everyone has an account:

# typed: ignore

require 'sidekiq/web'

Rails.application.routes.draw do
# Custom middleware to check JWT and admin role
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
# Attempt to authenticate with your existing auth system
# This is a simplified example - adjust based on your auth flow
begin
# Try to find user by email and authenticate
user = User.find_by(email: username)

if user && user.authenticate(password) # Assuming bcrypt
# Check if user has admin role
user.admin? || user.has_role?(:sidekiq_access)
else
false
end
rescue StandardError => e
Rails.logger.error "Sidekiq auth error: #{e.message}"
false
end
end

mount Sidekiq::Web, at: '/sidekiq'

# ... rest of routes
end