Puma config for production

sites
aeris 2017-10-29 11:36:41 +01:00
parent b1b95dcfa2
commit 6ffc42d08a
2 changed files with 29 additions and 0 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
.rakeTasks
*.iml
Gemfile.lock
.env.production
/db/*.sqlite3
/db/*.sqlite3-journal

28
config/puma.rb 100644
View File

@ -0,0 +1,28 @@
threads_count = ENV.fetch 'RAILS_MAX_THREADS', 5
threads threads_count, threads_count
env = ENV.fetch 'RAILS_ENV', 'development'
environment env
unless Rails.root
module Rails
ROOT = Dir.pwd
def self.root
ROOT
end
end
end
if env == 'production'
workers 4
listen = ENV.fetch('LISTEN') { 'unix://' + File.join(Rails.root, 'tmp/sockets/puma.sock') }
bind listen
else
listen = ENV.fetch('PORT') { 3001 }
port listen
end
pidfile File.join Rails.root, 'tmp/pids/puma.pid'
plugin :tmp_restart