diff --git a/README.md b/README.md index e4638e9..1096fe3 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Description=Partynest job processing [Service] ExecStart=/usr/bin/bundle exec sidekiq --environment production Group=group -Restart=on-failure +Restart=always RestartSec=1 StandardOutput=syslog StandardError=syslog diff --git a/config/deploy.rb b/config/deploy.rb index 07c892f..152c0a9 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -54,3 +54,4 @@ append :linked_dirs, after 'deploy:publishing', 'deploy:restart' after 'deploy:restart', 'puma:restart' +after 'deploy:restart', 'sidekiq:stop' diff --git a/config/sidekiq.yml b/config/sidekiq.yml new file mode 100644 index 0000000..b599b0e --- /dev/null +++ b/config/sidekiq.yml @@ -0,0 +1 @@ +:pidfile: tmp/pids/sidekiq.pid diff --git a/lib/capistrano/tasks/sidekiq.rake b/lib/capistrano/tasks/sidekiq.rake new file mode 100644 index 0000000..c02233f --- /dev/null +++ b/lib/capistrano/tasks/sidekiq.rake @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +namespace :sidekiq do + dest 'Stop Sidekiq app worker' + task :stop do + on roles(:app) do + within release_path do + pidfile = File.join shared_path, 'tmp', 'pids', 'sidekiq.pid' + execute :bundle, :exec, :sidekiqctl, :stop, pidfile + end + end + end +end