Skip to content

Instantly share code, notes, and snippets.

@tacionery
Last active May 30, 2016 21:58
Show Gist options
  • Save tacionery/da67278e93d933fb3154ee74a29f188e to your computer and use it in GitHub Desktop.
Save tacionery/da67278e93d933fb3154ee74a29f188e to your computer and use it in GitHub Desktop.
puma config
# config/puma.rb
threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 6)
workers Integer(ENV['WORKERS'] || 2)
port ENV['PORT'] || 3000
environment ENV['RAILS_ENV'] || 'development'
preload_app!
on_worker_boot do
require "active_record"
cwd = File.dirname(__FILE__)+"/.."
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
ActiveRecord::Base.establish_connection(ENV["DATABASE_URL"] || YAML.load_file("#{cwd}/config/database.yml")[ENV["RAILS_ENV"]])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment