Created
February 19, 2017 08:41
-
-
Save hackedunit/49ade312dac9eac8403df5a37635e4ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change to match your CPU core count | |
workers 8 | |
# Min and Max threads per worker | |
threads 4, 8 | |
app_dir = File.expand_path("../..", __FILE__) | |
shared_dir = "#{app_dir}/shared" | |
# Default to production | |
rails_env = ENV['RAILS_ENV'] || "production" | |
environment rails_env | |
# Set up socket location | |
bind "unix://#{shared_dir}/sockets/puma.sock" | |
# Logging | |
stdout_redirect "#{shared_dir}/log/puma.stdout.log", "#{shared_dir}/log/puma.stderr.log", true | |
# Set master PID and state locations | |
pidfile "#{shared_dir}/pids/puma.pid" | |
state_path "#{shared_dir}/pids/puma.state" | |
activate_control_app | |
# preload_app! | |
on_worker_boot do | |
require "active_record" | |
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished | |
ActiveRecord::Base.establish_connection(YAML.load_file("#{app_dir}/config/database.yml")[rails_env]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment