Browse Source

Puma config for production

new-scoring
aeris 1 year 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 @@
3 3
 .rakeTasks
4 4
 *.iml
5 5
 Gemfile.lock
6
+.env.production
6 7
 
7 8
 /db/*.sqlite3
8 9
 /db/*.sqlite3-journal

+ 28
- 0
config/puma.rb View File

@@ -0,0 +1,28 @@
1
+threads_count = ENV.fetch 'RAILS_MAX_THREADS', 5
2
+threads threads_count, threads_count
3
+
4
+env = ENV.fetch 'RAILS_ENV', 'development'
5
+environment env
6
+
7
+unless Rails.root
8
+	module Rails
9
+		ROOT = Dir.pwd
10
+
11
+		def self.root
12
+			ROOT
13
+		end
14
+	end
15
+end
16
+
17
+if env == 'production'
18
+	workers 4
19
+	listen = ENV.fetch('LISTEN') { 'unix://' + File.join(Rails.root, 'tmp/sockets/puma.sock') }
20
+	bind listen
21
+else
22
+	listen = ENV.fetch('PORT') { 3001 }
23
+	port listen
24
+end
25
+
26
+pidfile File.join Rails.root, 'tmp/pids/puma.pid'
27
+
28
+plugin :tmp_restart

Loading…
Cancel
Save