From 5007d6af0d04cdc3f7965729957a759d0eb1257b Mon Sep 17 00:00:00 2001 From: YOSHIDA Hiroki Date: Mon, 4 Nov 2013 20:13:36 +0900 Subject: [PATCH] =?UTF-8?q?refs=20#17=20=E4=B8=8D=E8=A6=81=E3=81=AAUnicorn?= =?UTF-8?q?=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/unicorn.rb | 70 ----------------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 config/unicorn.rb diff --git a/config/unicorn.rb b/config/unicorn.rb deleted file mode 100644 index feffd0b..0000000 --- a/config/unicorn.rb +++ /dev/null @@ -1,70 +0,0 @@ -# config/unicorn.rb -# Set environment to development unless something else is specified -ENV['RAILS_ENV'] ||= 'production' - -# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete -# documentation. -worker_processes 1 - -# Preload our app for more speed -preload_app true - -# nuke workers after 30 seconds instead of 60 seconds (the default) -timeout 60 - -application = 'clipclap' -shared_path = "/home/yoshida/public_html/#{application}/shared" - listen '/tmp/clipclap_unicorn.socket', :backlog => 1024 - -# Production specific settings -if ENV['RAILS_ENV'] == 'production' - worker_processes 4 - - # listen on both a Unix domain socket and a TCP port, - # we use a shorter backlog for quicker failover when busy - #listen 80, :backlog => 1024 - #listen 4422, :tcp_nopush => true - listen '/tmp/clipclap_unicorn.socket', :backlog => 1024 - - # Help ensure your application will always spawn in the symlinked - # "current" directory that Capistrano sets up. - working_directory "/home/yoshida/public_html/#{application}/current" - - # feel free to point this anywhere accessible on the filesystem - user 'yoshida', 'wheel' - - stderr_path "#{shared_path}/log/unicorn.stderr.log" - stdout_path "#{shared_path}/log/unicorn.stdout.log" -end - -before_fork do |server, worker| - # the following is highly recomended for Rails + "preload_app true" - # as there's no need for the master process to hold a connection - if defined?(ActiveRecord::Base) - ActiveRecord::Base.connection.disconnect! - end - - # Before forking, kill the master process that belongs to the .oldbin PID. - # This enables 0 downtime deploys. - old_pid = "#{shared_path}/pids/unicorn.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 -end - -after_fork do |server, worker| - # the following is *required* for Rails + "preload_app true", - if defined?(ActiveRecord::Base) - ActiveRecord::Base.establish_connection - end - - # if preload_app is true, then you may also want to check and - # restart any other shared sockets/descriptors such as Memcached, - # and Redis. TokyoCabinet file handles are safe to reuse - # between any number of forked children (assuming your kernel - # correctly implements pread()/pwrite() system calls) -end