Sha256: d1d174b38976e531fe7ca2fc595770d7af7fd58888395cf0668e6c7715094d3c

Contents?: true

Size: 1.43 KB

Versions: 43

Compression:

Stored size: 1.43 KB

Contents

namespace :rubber do
  namespace :sidekiq do

    rubber.allow_optional_tasks(self)

    before "deploy",        "rubber:sidekiq:quiet"
    after "deploy:stop",    "rubber:sidekiq:stop"
    after "deploy:start",   "rubber:sidekiq:start"
    after "deploy:restart", "rubber:sidekiq:restart"

    desc "Quiet sidekiq (stop accepting new work)"
    task :quiet, :roles => :sidekiq do
      rsudo "if [ -d #{current_path} ]; then cd #{current_path} && if [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then bundle exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid ; fi; fi", :as => rubber_env.app_user
    end

    desc "Stop sidekiq"
    task :stop, :roles => :sidekiq do
      # Allow workers up to 60 seconds to finish their processing.
      rsudo "cd #{current_path} && if [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then bundle exec sidekiqctl stop #{current_path}/tmp/pids/sidekiq.pid 60 ; fi", :as => rubber_env.app_user
    end

    desc "Start sidekiq"
    task :start, :roles => :sidekiq do
      rsudo "cd #{current_path} ; nohup bundle exec sidekiq -e #{Rubber.env} -C #{current_path}/config/sidekiq.yml -P #{current_path}/tmp/pids/sidekiq.pid >> #{current_path}/log/sidekiq.log 2>&1 &", :as => rubber_env.app_user
      sleep 45 # Give the workers some time to start up before moving on so monit doesn't try to start as well.
    end

    desc "Restart sidekiq"
    task :restart, :roles => :sidekiq do
      stop
      start
    end

  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
rubber-3.2.2 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-3.2.1 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-3.2.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-3.1.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-3.0.1 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-3.0.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.16.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.15.2 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.15.1 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.15.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.14.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.13.1 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.13.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.12.2 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.12.1 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.12.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.11.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.10.2 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.10.1 templates/sidekiq/config/rubber/deploy-sidekiq.rb
rubber-2.10.0 templates/sidekiq/config/rubber/deploy-sidekiq.rb