Skip to content

Commit 221fab4

Browse files
committed
AP-621: implement puma-plugin-delayed_stop
1 parent 0053dfb commit 221fab4

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ gem 'nokogiri', '~> 1.18'
1818
gem 'okcomputer', '~> 1.19'
1919
gem 'ougai', '~> 1.8'
2020
gem 'puma', '~> 6.6.1'
21+
gem 'puma-plugin-delayed_stop', '~> 0.1.2'
2122
gem 'rails', '~> 8.0.0'
2223
gem 'rake'
2324
gem 'sass-rails', '>= 6'

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ GEM
212212
public_suffix (7.0.0)
213213
puma (6.6.1)
214214
nio4r (~> 2.0)
215+
puma-plugin-delayed_stop (0.1.2)
216+
puma (>= 5.0, < 8)
215217
racc (1.8.1)
216218
rack (3.2.4)
217219
rack-proxy (0.7.7)
@@ -410,6 +412,7 @@ DEPENDENCIES
410412
okcomputer (~> 1.19)
411413
ougai (~> 1.8)
412414
puma (~> 6.6.1)
415+
puma-plugin-delayed_stop (~> 0.1.2)
413416
rails (~> 8.0.0)
414417
rake
415418
rspec-rails (~> 8.0)

config/puma.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
# Run the Solid Queue supervisor inside of Puma for single-server deployments
3737
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
3838

39+
# enable the delayed_stop plugin to intercept signals
40+
plugin :delayed_stop
41+
3942
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
4043
# In other environments, only set the PID file if requested.
4144
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ services:
2121
- db
2222
environment:
2323
DATABASE_URL: 'mysql2://root:root@db:3306/NARA'
24+
PUMA_DELAYED_STOP_DRAIN_SECONDS: 1
2425
ports:
2526
- 3000:3000
2627
restart: always
28+
stop_grace_period: 30s
29+
stop_signal: SIGQUIT
2730
volumes:
2831
- ./:/opt/app:delegated

0 commit comments

Comments
 (0)