LoginSignup
3
2

More than 5 years have passed since last update.

capistrano3でrestartタスク

Posted at

Capistranoの3.10でデプロイ後にサーバ(apache)を再起動させるためのタスクです。

config/deploy.rb
namespace :deploy do
  after :publishing, :restart

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      execute :sudo, 'service apache2 restart'
    end
  end
end

どのバージョンからかは定かでないですが、 cap install してもタスクの定義が生成されなくなってしまっていて構築の手がかりがなくなっています。

deploy:restart task not executing

上記は少し前のバージョンのテンプレートを参考にして実装しました。将来のバージョンでも正しく動くかは不明です…。

3
2
0

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
3
2