Running code when the Ruby on Rails webserver boots

I was recently part of a Mastodon discussion about the best way to run code in a Rails application before Puma boots. The need for this is that sometimes you want some code that only runs within a webserver, not when running rake tasks or rails commands or opening the console. Here we go… Via server do blocks Rails 6.1 added a Railtie#server hook that can be invoked in application.rb or a gem’s…