Files
game-data/config/puma.rb
T
2026-07-24 12:52:57 -04:00

29 lines
866 B
Ruby

app_dir = File.expand_path('..', __dir__)
directory app_dir
# load puma config from environment variables
environment ENV.fetch('RACK_ENV', 'development')
# listening address
host = ENV.fetch('BIND_HOST', '0.0.0.0')
port = ENV.fetch('PORT', 9292)
bind "tcp://#{host}:#{port}"
# Concurrency tuning
workers_count = ENV.fetch('WEB_CONCURRENCY', 2).to_i
workers workers_count
max_threads_count = ENV.fetch('PUMA_MAX_THREADS', ENV.fetch('RAILS_MAX_THREADS', 5)).to_i
min_threads_count = ENV.fetch('PUMA_MIN_THREADS', ENV.fetch('RAILS_MIN_THREADS', 1)).to_i
threads min_threads_count, max_threads_count
# Preload app code before forking worker processes for better memory usage (Copy-on-Write)
if workers_count > 0
preload_app!
before_fork do
# Disconnect Sequel connection pool in the master process before forking
DB.disconnect if defined?(DB)
end
end