Sha256: 71171d7bad7f824987e90fab650be25eba6cf27abe00d2c8cabfff4871a2ea36

Contents?: true

Size: 786 Bytes

Versions: 14

Compression:

Stored size: 786 Bytes

Contents

namespace :puma do
  namespace :workers do
    desc 'Add a worker'
    task :count do
      on roles (fetch(:puma_role)) do
        #TODO
        # cleanup
        # add host name/ip
        workers_count = capture("ps ax | grep -c 'puma: cluster worker: `cat  #{fetch(:puma_pid)}`'").to_i - 1
        log  "Workers count : #{workers_count}"
      end
    end

    # TODO
    # Add/remove workers to specific host/s
    # Define  # of workers to add/remove
    # Refactor
    desc 'Worker++'
    task :more do
      on roles (fetch(:puma_role)) do
        execute("kill -TTIN `cat  #{fetch(:puma_pid)}`")
      end
    end

    desc 'Worker--'
    task :less do
      on roles (fetch(:puma_role)) do
        execute("kill -TTOU `cat  #{fetch(:puma_pid)}`")
      end
    end


  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
capistrano3-puma-1.1.0 lib/capistrano/tasks/workers.cap
capistrano3-puma-1.0.0 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.9.0 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.8.5 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.8.4 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.8.3 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.8.2 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.8.1 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.8.0 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.7.0 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.6.1 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.6.0 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.5.1 lib/capistrano/tasks/workers.cap
capistrano3-puma-0.5.0 lib/capistrano/tasks/workers.cap