Without this, we are getting exceptions in production shortly after deployment due to multiple processes sharing database connections. This adds a puma configuration file, and moves the configuration to that file. Update bin/production_check to use a clustered, preloaded puma, since I assume that is what we must be running in production. Additionally, if the app boots, send a request that requires database access, and check for the expected response, before considering it working.
17 lines
286 B
Ruby
17 lines
286 B
Ruby
# frozen_string_literal: true
|
|
|
|
# :nocov:
|
|
environment ENV["RACK_ENV"] || "development"
|
|
port ENV["PORT"] || "3000"
|
|
threads 5, 5
|
|
|
|
if @config.options[:workers] > 0
|
|
silence_single_worker_warning
|
|
preload_app!
|
|
|
|
before_fork do
|
|
Sequel::DATABASES.each(&:disconnect)
|
|
end
|
|
end
|
|
# :nocov:
|