class Capistrano::Puma

Public Instance Methods

define_tasks() click to toggle source
# File lib/capistrano/puma.rb, line 97
def define_tasks
  eval_rakefile File.expand_path('../tasks/puma.rake', __FILE__)
end
puma_daemonize?() click to toggle source
# File lib/capistrano/puma.rb, line 144
def puma_daemonize?
  fetch(:puma_daemonize)
end
puma_plugins() click to toggle source
# File lib/capistrano/puma.rb, line 148
def puma_plugins
  Array(fetch(:puma_plugins)).collect do |bind|
    "plugin '#{bind}'"
  end.join("\n")
end
puma_preload_app?() click to toggle source
# File lib/capistrano/puma.rb, line 140
def puma_preload_app?
  fetch(:puma_preload_app)
end
puma_workers() click to toggle source
# File lib/capistrano/puma.rb, line 136
def puma_workers
  fetch(:puma_workers, 0)
end
register_hooks() click to toggle source
# File lib/capistrano/puma.rb, line 132
def register_hooks
  after 'deploy:check', 'puma:check'
end
set_defaults() click to toggle source
# File lib/capistrano/puma.rb, line 101
def set_defaults
  set_if_empty :puma_role, :app
  set_if_empty :puma_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
  # Configure "min" to be the minimum number of threads to use to answer
  # requests and "max" the maximum.
  set_if_empty :puma_threads, [0, 16]
  set_if_empty :puma_workers, 0
  set_if_empty :puma_rackup, -> { File.join(current_path, 'config.ru') }
  set_if_empty :puma_state, -> { File.join(shared_path, 'tmp', 'pids', 'puma.state') }
  set_if_empty :puma_pid, -> { File.join(shared_path, 'tmp', 'pids', 'puma.pid') }
  set_if_empty :puma_bind, -> { File.join("unix://#{shared_path}", 'tmp', 'sockets', 'puma.sock') }
  set_if_empty :puma_control_app, false
  set_if_empty :puma_default_control_app, -> { File.join("unix://#{shared_path}", 'tmp', 'sockets', 'pumactl.sock') }
  set_if_empty :puma_conf, -> { File.join(shared_path, 'puma.rb') }
  set_if_empty :puma_access_log, -> { File.join(shared_path, 'log', 'puma_access.log') }
  set_if_empty :puma_error_log, -> { File.join(shared_path, 'log', 'puma_error.log') }
  set_if_empty :puma_init_active_record, false
  set_if_empty :puma_preload_app, false
  set_if_empty :puma_daemonize, false
  set_if_empty :puma_tag, ''
  set_if_empty :puma_restart_command, 'bundle exec puma'

  # Chruby, Rbenv and RVM integration
  append :chruby_map_bins, 'puma', 'pumactl'
  append :rbenv_map_bins, 'puma', 'pumactl'
  append :rvm_map_bins, 'puma', 'pumactl'

  # Bundler integration
  append :bundle_bins, 'puma', 'pumactl'
end
upload_puma_rb(role) click to toggle source
# File lib/capistrano/puma.rb, line 154
def upload_puma_rb(role)
  template_puma 'puma', fetch(:puma_conf), role
end