Sha256: e3f22628ecfe974f3c63281e0018c38e556d2559ad80f8637355283cc42a0618

Contents?: true

Size: 1.5 KB

Versions: 16

Compression:

Stored size: 1.5 KB

Contents

Capistrano::Configuration.instance.load do
  after 'deploy:stop', 'puma:stop'
  after 'deploy:start', 'puma:start'
  after 'deploy:restart', 'puma:restart'

  # Ensure the tmp/sockets directory is created by the deploy:setup task and
  # symlinked in by the deploy:update task. This is not handled by Capistrano
  # v2 but is fixed in v3.
  shared_children.push('tmp/sockets')

  _cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
  _cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
  _cset(:puma_state) { "#{shared_path}/sockets/puma.state" }
  _cset(:puma_socket) { "unix://#{shared_path}/sockets/puma.sock" }
  _cset(:puma_role) { :app }

  namespace :puma do
    desc 'Start puma'
    task :start, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
      puma_env = fetch(:rack_env, fetch(:rails_env, 'production'))
      run "cd #{current_path} && #{fetch(:puma_cmd)} -q -d -e #{puma_env} -b '#{fetch(:puma_socket)}' -S #{fetch(:puma_state)} --control 'unix://#{shared_path}/sockets/pumactl.sock'", :pty => false
    end

    desc 'Stop puma'
    task :stop, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
      run "cd #{current_path} && #{fetch(:pumactl_cmd)} -S #{fetch(:puma_state)} stop"
    end

    desc 'Restart puma'
    task :restart, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
      run "cd #{current_path} && #{fetch(:pumactl_cmd)} -S #{fetch(:puma_state)} restart"
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puma-2.3.2-java lib/puma/capistrano.rb
puma-2.3.2 lib/puma/capistrano.rb
puma-2.3.1-java lib/puma/capistrano.rb
puma-2.3.1 lib/puma/capistrano.rb
puma-2.3.0-java lib/puma/capistrano.rb
puma-2.3.0 lib/puma/capistrano.rb
puma-2.2.2-java lib/puma/capistrano.rb
puma-2.2.2 lib/puma/capistrano.rb
puma-2.2.1-java lib/puma/capistrano.rb
puma-2.2.1 lib/puma/capistrano.rb
puma-2.2.0-java lib/puma/capistrano.rb
puma-2.2.0 lib/puma/capistrano.rb
puma-2.1.1-java lib/puma/capistrano.rb
puma-2.1.1 lib/puma/capistrano.rb
puma-2.1.0-java lib/puma/capistrano.rb
puma-2.1.0 lib/puma/capistrano.rb