Skip to content

Commit

Permalink
Add sidekiq admin rack application (#4158)
Browse files Browse the repository at this point in the history
* Add sidekiq-admin rack app with basic auth, pro ui, and scheduler ui
* Clearly specify port and server to use for rackup
* Ensure sidekiq-admin is only started manually
  • Loading branch information
johnpaulashenfelter authored Jun 12, 2020
1 parent 4a0c2cb commit 076ad21
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sidekiq-admin.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Run sidekiq-admin: `SIDEKIQ_USERNAME=foo SIDEKIQ_PASSWORD=bar REDIS_URL=redis://some.elasticache.aws.url bundle exec rackup sidekiq-admin.ru -p 3000 -o 0.0.0.0`

require 'sidekiq'
require 'sidekiq-pro'
require 'sidekiq-scheduler/web'
require 'sidekiq/pro/web'

Sidekiq.configure_client do |config|
config.redis = { :size => 1 }
end

map '/sidekiq' do
use Rack::Auth::Basic, "Protected Area" do |username, password|
Rack::Utils.secure_compare(::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_USERNAME"])) &
Rack::Utils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_PASSWORD"]))
end

run Sidekiq::Web
end

0 comments on commit 076ad21

Please sign in to comment.