I had a look at dry-system and hanami, it’s much easier to expose a method Hanami.shutdown to be used in Puma before_fork.
# config/puma.rb
before_fork do
Hanami.shutdown
end
The implementation should hook into Dry::System::Container#shutdown! which iterates for each registered bootable component and triggers the stop block.