最近在发布的时候出现了这个错误,自己搞整了一天无果... unicorn 配置:
require 'ohm'
require 'ohm/contrib'
worker_processes 4
deploy_to = "/var/games"
application = "web20"
working_directory "#{deploy_to}/#{application}/current"
#app_path "#{deploy_to}/#{application}/current"
listen "/tmp/#{application}.sock", :backlog => 256
timeout 300
pid "#{deploy_to}/#{application}/shared/pids/unicorn.pid"
stderr_path "#{deploy_to}/#{application}/shared/log/unicorn.stderr.log"
stdout_path "#{deploy_to}/#{application}/shared/log/unicorn.stdout.log"
preload_app true
GC.respond_to?(:copy_on_write_friendly=) and
GC.copy_on_write_friendly = true
before_fork do |server, worker|
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
Redis.current.quit
sleep(2)
end
after_fork do |server, worker|
Redis.current = Redis.new :host => '127.0.0.1', :port => 6789, :driver => :hiredis
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end