Sha256: ed7efc11564ad51b28b4d3ca724160671a781fec28a402d7df628de3b477046a

Contents?: true

Size: 917 Bytes

Versions: 2

Compression:

Stored size: 917 Bytes

Contents

Capistrano::Configuration.instance.load do
  before "deploy", "sidekiq:quiet"
  after "deploy", "sidekiq:restart"

  _cset(:sidekiq_timeout) { 10 }

  namespace :sidekiq do

    desc "Quiet sidekiq (stop accepting new work)"
    task :quiet do
      run "cd #{current_path} && bundle exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid"
    end

    desc "Stop sidekiq"
    task :stop do
      run "cd #{current_path} && bundle exec sidekiqctl stop #{current_path}/tmp/pids/sidekiq.pid #{fetch :sidekiq_timeout}"
    end

    desc "Start sidekiq"
    task :start do
      rails_env = fetch(:rails_env, "production")
      run "cd #{current_path} ; nohup bundle exec sidekiq -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{current_path}/tmp/pids/sidekiq.pid >> #{current_path}/log/sidekiq.log 2>&1 &"
    end

    desc "Restart sidekiq"
    task :restart do
      stop
      start
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-0.11.0 lib/sidekiq/capistrano.rb
sidekiq-0.10.1 lib/sidekiq/capistrano.rb