Skip to content

Commit 77307f6

Browse files
Add delayed stop puma plugin (#21)
1 parent 43c98b8 commit 77307f6

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ gem 'omniauth-rails_csrf_protection', '~> 1.0'
1818
gem 'pg', '~> 1.4'
1919
gem 'pg_search', '~> 2.3'
2020
gem 'puma', '~> 7.2'
21+
gem 'puma-plugin-delayed_stop', '~> 0.1.2'
2122
gem 'rack-cors'
2223
gem 'rails', '~> 8.0.5'
2324
gem 'ransack', '~> 4.2'

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ GEM
253253
public_suffix (7.0.5)
254254
puma (7.2.0)
255255
nio4r (~> 2.0)
256+
puma-plugin-delayed_stop (0.1.2)
257+
puma (>= 5.0, < 8)
256258
racc (1.8.1)
257259
rack (3.2.5)
258260
rack-cors (2.0.2)
@@ -442,6 +444,7 @@ DEPENDENCIES
442444
pg (~> 1.4)
443445
pg_search (~> 2.3)
444446
puma (~> 7.2)
447+
puma-plugin-delayed_stop (~> 0.1.2)
445448
rack-cors
446449
rails (~> 8.0.5)
447450
rails-controller-testing

config/puma.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@
4141

4242
# Allow puma to be restarted by `bin/rails restart` command.
4343
plugin :tmp_restart
44+
45+
# Adds a drain period during shutdown so swarm can elegantly remove it from the routing mesh
46+
plugin :delayed_stop

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
environment:
1010
- SERVE_TEST_UI=${SERVE_TEST_UI:-true}
1111
- GALC_API_URL=${GALC_API_URL:-http://localhost:3000}
12+
- PUMA_DELAYED_STOP_DRAIN_SECONDS=1
1213
init: true
1314
networks:
1415
default:
@@ -19,6 +20,8 @@ services:
1920
ports:
2021
- 3000:3000
2122
restart: always
23+
stop_grace_period: 30s
24+
stop_signal: SIGQUIT
2225

2326
db:
2427
environment:
@@ -38,5 +41,3 @@ services:
3841

3942
volumes:
4043
postgres_data: { }
41-
42-
version: '3.8'

0 commit comments

Comments
 (0)