Sha256: e9ab3dcf2d26b2b36e854a61b0ebde66a0be1b8ad7960060341e41b8d7e63d74

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

set :puma_rb, 'config/puma.rb'

namespace :puma do
  desc 'Start puma'
  task :start do
    on roles :app do
      within release_path do
        execute :bundle, "exec puma -C #{fetch :puma_rb} -b 'unix://#{shared_path}/sockets/puma.sock' --pidfile #{shared_path}/pids/puma.pid -S #{state_path} -e #{fetch :stage} -d"
      end
    end
  end

  desc 'Stop puma'
  task :stop do
    on roles :app do
      within release_path do
        execute :bundle, "exec pumactl -S #{state_path} stop;true"
      end
    end
  end

  desc 'Restart puma'
  task :restart do
    on roles :app do
      within release_path do
        execute :bundle, "exec pumactl -S #{state_path} restart;true"
      end
    end
  end

  desc 'Phased restart puma'
  task :phased_restart do
    on roles :app do
      within release_path do
        execute :bundle, "exec pumactl -S #{state_path} phased-restart;true"
      end
    end
  end

  desc 'Cold Restart puma'
  task :cold_restart do
    invoke 'puma:stop'
    sleep 3
    invoke 'puma:start'
  end

  def state_path
    "#{shared_path}/sockets/puma.state"
  end

  before 'deploy:published', 'puma:cold_restart'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
h2ocube_rails_puma-0.0.6 lib/capistrano/tasks/puma.cap