Sha256: 24b67a3ac780a743c8cfeba82750c914b805bb268a79b3af25b526d0ef2c44ac
Contents?: true
Size: 1.07 KB
Versions: 6
Compression:
Stored size: 1.07 KB
Contents
working_directory "<%= current_path %>" pid "<%= unicorn_pid %>" stderr_path "<%= unicorn_log %>" stdout_path "<%= unicorn_log %>" listen "/tmp/<%= application %>.sock" worker_processes <%= unicorn_workers %> timeout 90 preload_app true before_exec do |server| ENV["BUNDLE_GEMFILE"] = "<%= current_path %>/Gemfile" end before_fork do |server, worker| # Disconnect since the database connection will not carry over if defined? ActiveRecord::Base ActiveRecord::Base.connection.disconnect! end # Quit the old unicorn process old_pid = "#{server.config[:pid]}.oldbin" if File.exists?(old_pid) && server.pid != old_pid begin Process.kill("QUIT", File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH # someone else did our job for us end end if defined?(Resque) Resque.redis.quit end sleep 1 end after_fork do |server, worker| # Start up the database connection again in the worker if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection end if defined?(Resque) Resque.redis = 'localhost:6379' end end
Version data entries
6 entries across 6 versions & 1 rubygems