Browse Source

Puma config for production

new-scoring
aeris 2 years ago
parent
commit
6ffc42d08a
2 changed files with 29 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 28
    0
      config/puma.rb

+ 1
- 0
.gitignore View File

@@ -3,6 +3,7 @@
.rakeTasks
*.iml
Gemfile.lock
.env.production

/db/*.sqlite3
/db/*.sqlite3-journal

+ 28
- 0
config/puma.rb 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

Loading…
Cancel
Save