Skip to content
Browse files

Add unicorn.rb and unicorn.rake

  • Loading branch information...
1 parent 36120d1 commit 31737fa984a7aef76b6385b41843e98f45118274 @ereslibre ereslibre committed
Showing with 27 additions and 0 deletions.
  1. +23 −0 config/unicorn.rb
  2. +4 −0 lib/tasks/unicorn.rake
View
23 config/unicorn.rb
@@ -0,0 +1,23 @@
+worker_processes 1
+working_directory File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+preload_app true
+
+timeout 30
+
+listen "/tmp/redmine.socket", :backlog => 64
+
+pid "/tmp/redmine.pid"
+
+stderr_path "/tmp/redmine.stderr.log"
+stdout_path "/tmp/redmine.stdout.log"
+
+before_fork do |server, worker|
+ defined?(ActiveRecord::Base) and
+ ActiveRecord::Base.connection.disconnect!
+end
+
+after_fork do |server, worker|
+ defined?(ActiveRecord::Base) and
+ ActiveRecord::Base.establish_connection
+end
View
4 lib/tasks/unicorn.rake
@@ -0,0 +1,4 @@
+desc "Run unicorn"
+task :unicorn do
+ system "bundle exec unicorn_rails -c config/unicorn.rb -Eproduction -D"
+end

0 comments on commit 31737fa

Please sign in to comment.
Something went wrong with that request. Please try again.