Files
ubicloud/puma_config.rb
Jeremy Evans 32a5ea76a1 Disconnect Sequel::Database instance before fork
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.
2025-03-14 12:23:11 -07:00

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: