mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
968bc81043
* Simplify Web UI sessions Remove all of the hacks and support infrastructure around Rack sessions. Rails provides this by default so we don't need it for 95% of users. The other 5% need to provide a Rack session. This is a big change and has the potential to break installs so it deserves at least a minor version bump. See also #4671, #4728 and many others.
19 lines
692 B
Ruby
19 lines
692 B
Ruby
# Easiest way to run Sidekiq::Web.
|
|
# Run with "bundle exec rackup simple.ru"
|
|
|
|
require 'sidekiq/web'
|
|
|
|
# A Web process always runs as client, no need to configure server
|
|
Sidekiq.configure_client do |config|
|
|
config.redis = { url: 'redis://localhost:6379/0', size: 1 }
|
|
end
|
|
|
|
Sidekiq::Client.push('class' => "HardWorker", 'args' => [])
|
|
|
|
# In a multi-process deployment, all Web UI instances should share
|
|
# this secret key so they can all decode the encrypted browser cookies
|
|
# and provide a working session.
|
|
# Rails does this in /config/initializers/secret_token.rb
|
|
secret_key = SecureRandom.hex(32)
|
|
use Rack::Session::Cookie, secret: secret_key, same_site: true, max_age: 86400
|
|
run Sidekiq::Web
|