1
0
Fork 0

Added puma

This commit is contained in:
Andrew Tomaka 2016-03-08 19:57:25 -05:00
parent b8a3e56665
commit af8206ef5b
3 changed files with 34 additions and 0 deletions

View File

@ -45,3 +45,6 @@ group :development do
gem 'spring'
end
group :production do
gem 'puma'
end

View File

@ -74,6 +74,7 @@ GEM
multi_json (1.11.2)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
puma (3.1.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
@ -151,6 +152,7 @@ DEPENDENCIES
coffee-rails (~> 4.1.0)
jbuilder (~> 2.0)
jquery-rails
puma
rails (= 4.2.5.1)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)

29
config/puma.rb Normal file
View File

@ -0,0 +1,29 @@
# Change to match your CPU core count
workers 1
# Min and Max threads per worker
threads 1, 6
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
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