Sha256: aa2fea4a5cde39c7f049b2d5c84db12e2a9b523fb5c6fa40c471a4cad776036b

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

# configuration variables
_cset(:delayed_job_workers, {})

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

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

monit_config "delayed_job", <<EOF.dedent, :roles => :worker
  <% delayed_job_workers.each do |name, range| %>
  check process delayed_job_<%= name %>
  with pidfile <%= pid_path %>/delayed_job.<%= name %>.pid
  <% if range.nil? %>
  start program = "<%= delayed_job_script %> start <%= name %>"
  stop program = "<%= delayed_job_script %> stop <%= name %>"
  <% else %>
  start program = "<%= delayed_job_script %> start <%= name %> <%= range.begin %> <%= range.end %>"
  stop program = "<%= delayed_job_script %> stop <%= name %> <%= range.begin %> <%= range.end %>"
  <% end %>
  group delayed_job

  <% end %>
EOF

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capper-2.0.0.pre1 lib/capper/delayed_job.rb