LoginSignup
11
11

More than 5 years have passed since last update.

capistranoでのunicorn再起動タスク

Posted at

最低限こんなもんでいいんじゃね程度

config/deploy.rb
namespace :deploy do
  task :start do
    run "bundle exec unicorn_rails -c #{current_path}/config/unicorn.rb -E production -D"
  end

  task :stop do
    run "kill -QUIT `cat #{current_path}/tmp/pids/unicorn.pid`"
  end

  task :restart do
    run "kill -USR2 `cat #{current_path}/tmp/pids/unicorn.pid`"
    run "kill -QUIT `cat #{current_path}/tmp/pids/unicorn.pid.oldbin`"
  end
end
config/unicorn.rb
worker_processes 2
listen      File.expand_path('tmp/sockets/unicorn.sock', ENV['RAILS_ROOT'])
pid         File.expand_path('tmp/pids/unicorn.pid',     ENV['RAILS_ROOT'])
stdout_path File.expand_path('log/unicorn.log',          ENV['RAILS_ROOT'])
stderr_path File.expand_path('log/unicorn.log',          ENV['RAILS_ROOT'])
11
11
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11