Browse Source

Puma config for production

master
aeris 5 years ago
parent
commit
6ffc42d08a
  1. 1
      .gitignore
  2. 28
      config/puma.rb

1
.gitignore

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

28
config/puma.rb

@ -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
Loading…
Cancel
Save