working_directory "<%= current_path %>" pid "<%= fetch(:unicorn_pid) %>" stderr_path "<%= fetch(:unicorn_log) %>" stdout_path "<%= fetch(:unicorn_log) %>" listen "/tmp/unicorn.<%= fetch(:application) %>.sock" worker_processes <%= fetch(:unicorn_workers) %> timeout <%= fetch(:unicorn_timeout) %> preload_app true before_fork do |server, worker| # Disconnect since the database connection will not carry over if defined? ActiveRecord::Base ActiveRecord::Base.connection.disconnect! end end after_fork do |server, worker| # Start up the database connection again in the worker if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection end end