File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ app_path = File . expand_path ( File . dirname ( __FILE__ ) + '/..' )
2
+
3
+ worker_processes 2
4
+
5
+ listen listen 8080 , tcp_nopush : true
6
+
7
+ working_directory app_path
8
+
9
+ pid app_path + '/tmp/unicorn.pid'
10
+
11
+ stderr_path '/var/www/timeoverflow/shared/log/unicorn.log'
12
+ stdout_path '/var/www/timeoverflow/shared/log/unicorn.log'
13
+
14
+ # Load the app up before forking
15
+ # Combine Ruby 2.0.0+ with "preload_app true" for memory savings
16
+ preload_app true
17
+
18
+ before_fork do |server , worker |
19
+ # the following is highly recomended for Rails + "preload_app true"
20
+ # as there's no need for the master process to hold a connection
21
+ defined? ( ActiveRecord ::Base ) and
22
+ ActiveRecord ::Base . connection . disconnect!
23
+ end
24
+
25
+ after_fork do |server , worker |
26
+ # the following is *required* for Rails + "preload_app true"
27
+ defined? ( ActiveRecord ::Base ) and
28
+ ActiveRecord ::Base . establish_connection
29
+ end
You can’t perform that action at this time.
0 commit comments