Added puma
This commit is contained in:
parent
b8a3e56665
commit
af8206ef5b
3 changed files with 34 additions and 0 deletions
3
Gemfile
3
Gemfile
|
@ -45,3 +45,6 @@ group :development do
|
||||||
gem 'spring'
|
gem 'spring'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :production do
|
||||||
|
gem 'puma'
|
||||||
|
end
|
||||||
|
|
|
@ -74,6 +74,7 @@ GEM
|
||||||
multi_json (1.11.2)
|
multi_json (1.11.2)
|
||||||
nokogiri (1.6.7.2)
|
nokogiri (1.6.7.2)
|
||||||
mini_portile2 (~> 2.0.0.rc2)
|
mini_portile2 (~> 2.0.0.rc2)
|
||||||
|
puma (3.1.0)
|
||||||
rack (1.6.4)
|
rack (1.6.4)
|
||||||
rack-test (0.6.3)
|
rack-test (0.6.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
@ -151,6 +152,7 @@ DEPENDENCIES
|
||||||
coffee-rails (~> 4.1.0)
|
coffee-rails (~> 4.1.0)
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.0)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
puma
|
||||||
rails (= 4.2.5.1)
|
rails (= 4.2.5.1)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
|
|
29
config/puma.rb
Normal file
29
config/puma.rb
Normal 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
|
Loading…
Reference in a new issue