diff --git a/Dockerfile b/Dockerfile index 1d68bb7..42b984f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ WORKDIR /sidekiq COPY Gemfile* ./ COPY config.ru . +RUN bundle update sidekiq RUN bundle install CMD rackup config.ru -o 0.0.0.0 -p 3030 -q diff --git a/Gemfile b/Gemfile index f9d7660..5271c96 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source 'https://rubygems.org' -gem 'sidekiq', '~> 5.1' -gem 'sinatra', '~> 2.0' \ No newline at end of file +gem 'sidekiq', '~> 6.4.0' +gem 'sinatra', '~> 2.0' +gem 'redis-namespace', '~> 1.8.1', :require => 'redis/namespace' diff --git a/README.md b/README.md index b6e8d68..3c0ef97 100644 --- a/README.md +++ b/README.md @@ -51,4 +51,10 @@ services: SIDEKIQ_PASSWORD: password123 ports: - 3030:3030 -``` \ No newline at end of file +``` + +## Build a new container if you make changes + +``` +docker build -t aschzero/sidekiq-web . +``` diff --git a/config.ru b/config.ru index 3ecb88f..7915f1b 100644 --- a/config.ru +++ b/config.ru @@ -1,15 +1,19 @@ require 'sidekiq' require 'sidekiq/web' +require 'securerandom'; File.open(".session.key", "w") {|f| f.write(SecureRandom.hex(32)) } sidekiq_user = ENV.fetch('SIDEKIQ_USER') { 'admin' } sidekiq_password = ENV.fetch('SIDEKIQ_PASSWORD') { 'admin' } Sidekiq.configure_client do |config| - config.redis = { url: ENV['REDIS_URL'] } + config.redis = { url: ENV['REDIS_URL'], namespace: ENV['REDIS_NAMESPACE'] } end Sidekiq::Web.use(Rack::Auth::Basic) do |user, password| [user, password] == [sidekiq_user, sidekiq_password] end +# now use the secret with a session cookie middleware +use Rack::Session::Cookie, secret: File.read(".session.key"), same_site: true, max_age: 86400 + run Sidekiq::Web