Sha256: c4325a5905e30cbd7fbe2528d8c0aca4ab79bfbcaad027cb85d5ebc9ab1c5ff2

Contents?: true

Size: 982 Bytes

Versions: 22

Compression:

Stored size: 982 Bytes

Contents

Standup.script :node do
  def run
    scripts.redis.run unless scripts.redis.installed?

    path_to_resque_exec = "#{scripts.webapp.app_path}/script/resque"
    with_processed_file script_file('resque') do |file|
      upload file,
             :to => path_to_resque_exec,
             :sudo => true
    end

    sudo "chown www-data:www-data #{path_to_resque_exec}"
    sudo "chmod +x #{path_to_resque_exec}"

    sudo "mkdir #{scripts.webapp.app_path}/tmp/pids"
    sudo "chown www-data:www-data #{scripts.webapp.app_path}/tmp/pids"
    with_processed_file script_file('resque_monit.conf') do |file|
      scripts.monit.add_watch file
    end

    restart
  end

  def restart
    ((scripts.webapp.params.has_key?(:resque_queues) && scripts.webapp.params.resque_queues.presence) || {"ALL_QUEUES" => 1 }).each_pair do |queue_name, num_of_workers|
      1.upto(num_of_workers)  do |num|
        scripts.monit.restart_watch "resque_#{queue_name}_#{num}"
      end
     end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
standup-0.5.3 scripts/resque.rb
standup-0.5.1 scripts/resque.rb