Sha256: 5b3757c95137458c2793661bc302c7729c40150e59bb6cbdd81d9749e05f094f

Contents?: true

Size: 1.53 KB

Versions: 4

Compression:

Stored size: 1.53 KB

Contents

# configuration variables
_cset(:delayed_job_workers, {})

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

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

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")
    upload_template_file("delayed_job@.service",
                         delayed_job_service,
                         :mode => "0755")
    systemctl "daemon-reload"
    delayed_job_workers.each do |name|
      systemctl :enable, "delayed_job@#{name}"
    end
  end

  desc "Start delayed job workers"
  task :start, :roles => :app, :except => { :no_release => true } do
    delayed_job_workers.each do |name|
      systemctl :start, "delayed_job@#{name}"
    end
  end

  desc "Stop delayed job workers"
  task :stop, :roles => :app, :except => { :no_release => true } do
    delayed_job_workers.each do |name|
      systemctl :stop, "delayed_job@#{name}"
    end
  end

  desc "Restart delayed job workers"
  task :restart, :roles => :app, :except => { :no_release => true } do
    delayed_job_workers.each do |name|
      systemctl :restart, "delayed_job@#{name}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capper-2.0.0 lib/capper/delayed_job.rb
capper-2.0.0.rc3 lib/capper/delayed_job.rb
capper-2.0.0.rc2 lib/capper/delayed_job.rb
capper-2.0.0.rc1 lib/capper/delayed_job.rb