diff --git a/Gemfile b/Gemfile index 5ba49b9..df3d2dd 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,7 @@ gem 'pagy', '~> 43' gem 'pg', '~> 1.2' gem 'pg_search', '~> 2.3' gem 'puma', '~> 7.2' +gem 'puma-plugin-delayed_stop', '~> 0.1.2' gem 'rails', '~> 8.0.4' gem 'ruby-vips', '~> 2.3' gem 'sprockets-rails', '~> 3.5.0' diff --git a/Gemfile.lock b/Gemfile.lock index df48e30..7959c49 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -287,6 +287,8 @@ GEM public_suffix (7.0.2) puma (7.2.0) nio4r (~> 2.0) + puma-plugin-delayed_stop (0.1.2) + puma (>= 5.0, < 8) racc (1.8.1) rack (3.2.5) rack-protection (4.2.1) @@ -505,6 +507,7 @@ DEPENDENCIES pg (~> 1.2) pg_search (~> 2.3) puma (~> 7.2) + puma-plugin-delayed_stop (~> 0.1.2) rails (~> 8.0.4) rspec (~> 3.10) rspec-rails (~> 8.0) diff --git a/config/puma.rb b/config/puma.rb index 565587c..2c9cfb3 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -33,6 +33,10 @@ # Allow puma to be restarted by `bin/rails restart` command. plugin :tmp_restart +# Adds a drain period during shutdown so swarm can elegantly remove it from +# the routing mesh +plugin :delayed_stop + # Run the Solid Queue supervisor inside of Puma for single-server deployments plugin :solid_queue if ENV['SOLID_QUEUE_IN_PUMA']