Sha256: d33d5397019e6ba4551ef712f660df6cc33d0a7606290db4da49ca448be30c40

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:phased_restart'
end

Version data entries

1 entries across 1 versions & 1 rubygems

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