diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 61ad22a..5a21a94 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,6 @@ jobs: fail-fast: false matrix: ruby_version: ["3.0", "3.1", "3.2", "3.3"] - rack_version: ["2.2.5", "3.1"] runs-on: ubuntu-latest services: postgres: @@ -46,14 +45,13 @@ jobs: PGPASSWORD: password PGHOST: localhost BUNDLE_RUBYGEMS__PKG__GITHUB__COM: gocardless-robot-readonly:${{ secrets.GITHUB_TOKEN }} - RACK_VERSION: "${{ matrix.rack_version }}" steps: - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: "${{ matrix.ruby_version }}" + ruby-version: "${{ matrix.ruby-version }}" - name: Start bin/que run: | bundle exec bin/que ./lib/que.rb --metrics-port=8080 --ci diff --git a/Gemfile b/Gemfile index e735f2d..29c8aa4 100644 --- a/Gemfile +++ b/Gemfile @@ -17,14 +17,6 @@ group :development, :test do gem 'rubocop-rspec', '~> 3.0.2' gem 'rubocop-sequel', '~> 0.3.4' gem 'sequel', require: nil - - rack_version = ENV.fetch('RACK_VERSION', "3.1") - gem "rack", rack_version - if Gem::Version.new(rack_version) < Gem::Version.new('3.0.0') - gem "rackup", "~> 1.0" - else - gem "rackup", "~> 2.0" - end end group :test do diff --git a/bin/que b/bin/que index 13e7baf..b38d3f9 100755 --- a/bin/que +++ b/bin/que @@ -4,16 +4,16 @@ require "logger" require "optparse" require "ostruct" -require "prometheus/middleware/exporter" -require "prometheus_gcstat" -require "puma" require "que" require "rack" -USE_RACKUP = Rack.release.split(".")[0].to_i >= 3 -if USE_RACKUP +require "prometheus/middleware/exporter" +require "prometheus_gcstat" +require "webrick" + +if Rack.release[0] == "3" + # Required if using Rack 3.x require "rackup" end -require "rack/handler/puma" $stdout.sync = true @@ -176,21 +176,25 @@ if options.metrics_port ) host = "0.0.0.0" - - handler = - if USE_RACKUP - Rackup::Handler::Puma - else - Rack::Handler::Puma - end - - handler.run( - app, - Host: host, - Port: options.metrics_port, - Silent: false, - AccessLog: [], - ) + logger = WEBrick::Log.new("/dev/null") + + if Rack.release[0] == "3" + Rackup::Handler::WEBrick.run( + app, + Host: host, + Port: options.metrics_port, + Logger: logger, + AccessLog: [], + ) + else + Rack::Handler::WEBrick.run( + app, + Host: host, + Port: options.metrics_port, + Logger: logger, + AccessLog: [], + ) + end end end diff --git a/que.gemspec b/que.gemspec index bc5ffc5..2c0b74c 100644 --- a/que.gemspec +++ b/que.gemspec @@ -27,9 +27,9 @@ Gem::Specification.new do |spec| # This is highly non ideal, but unless we properly fork, we have to do this for now. spec.add_dependency "prometheus-client" - spec.add_dependency "puma" spec.add_dependency "rack", ">= 2", "< 4" spec.add_dependency "rackup" + spec.add_dependency "webrick" spec.add_runtime_dependency "activesupport" spec.metadata["rubygems_mfa_required"] = "true"