Sha256: 0c3cb991f6cf89d0237e36f43ab1ed985a12adb07058f12fcd3054d37e865fe4

Contents?: true

Size: 1.15 KB

Versions: 26

Compression:

Stored size: 1.15 KB

Contents

# configuration variables
_cset(:resque_workers, {})

# these cannot be overriden
set(:resque_script) { File.join(bin_path, "resque") }

after "deploy:update_code", "resque:setup"
after "deploy:restart", "resque:restart"

monit_config "resque", <<EOF, :roles => :worker
<% resque_workers.each do |name, queue| %>
check process resque_<%= name %>
with pidfile <%= pid_path %>/resque.<%= name %>.pid
<% if queue.nil? %>
start program = "<%= resque_script %> <%= name %> * start"
stop program = "<%= resque_script %> <%= name %> * stop"
<% else %>
start program = "<%= resque_script %> <%= name %> <%= queue %> start"
stop program = "<%= resque_script %> <%= name %> <%= queue %> stop"
<% end %>
group resque

<% end %>
EOF

namespace :resque do
  desc "Generate resque configuration files"
  task :setup, :roles => :worker, :except => { :no_release => true } do
    upload_template_file("resque.sh",
                         resque_script,
                         :mode => "0755")
  end

  desc "Restart resque workers"
  task :restart, :roles => :worker, :except => { :no_release => true } do
    if fetch(:monitrc, false)
      run "monit -g resque restart all"
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
capper-0.9.23 lib/capper/resque.rb
capper-0.9.22 lib/capper/resque.rb
capper-0.9.21 lib/capper/resque.rb
capper-0.9.20 lib/capper/resque.rb
capper-0.9.19 lib/capper/resque.rb
capper-0.9.18 lib/capper/resque.rb
capper-0.9.17 lib/capper/resque.rb
capper-0.9.16 lib/capper/resque.rb
capper-0.9.15 lib/capper/resque.rb
capper-0.9.14 lib/capper/resque.rb
capper-0.9.13 lib/capper/resque.rb
capper-0.9.12 lib/capper/resque.rb
capper-0.9.11 lib/capper/resque.rb
capper-0.9.10 lib/capper/resque.rb
capper-0.9.9 lib/capper/resque.rb
capper-0.9.8 lib/capper/resque.rb
capper-0.9.7 lib/capper/resque.rb
capper-0.9.6 lib/capper/resque.rb
capper-0.9.5 lib/capper/resque.rb
capper-0.9.4 lib/capper/resque.rb