capistrano3-puma 1.2.1

Puma integration for Capistrano 3

Homepage: https://github.com/seuros/capistrano-puma

Platform: Rubygems

Language: Shell

License: MIT

View on registry: https://rubygems.org/gems/capistrano3-puma/versions/1.2.1

Documentation: http://www.rubydoc.info/gems/capistrano3-puma/1.2.1

Direct download link: https://rubygems.org/downloads/capistrano3-puma-1.2.1.gem

Install: gem install capistrano3-puma -v 1.2.1


Gem Version

Capistrano::Puma

Installation

Add this line to your application's Gemfile:

gem 'capistrano3-puma', github: "seuros/capistrano-puma"

or:

gem 'capistrano3-puma' , group: :development

And then execute:

$ bundle

Usage

    # Capfile

    require 'capistrano/puma'
    require 'capistrano/puma/workers' # if you want to control the workers (in cluster mode)
    require 'capistrano/puma/jungle'  # if you need the jungle tasks
    require 'capistrano/puma/monit'   # if you need the monit tasks
    require 'capistrano/puma/nginx'   # if you want to upload a nginx site template

Config

To list available tasks use cap -T

To upload puma config use:

cap puma:config 

By default the file located in shared/puma.config

Ensure that tmp/pids and tmp/sockets log are shared (via linked_dirs):

This step is mandatory before deploying, otherwise puma server won't start

Nginx

To upload a nginx site config (eg. /etc/nginx/sites-enabled/) use:

cap puma:nginx_config

To customize these two templates locally before uploading use:

rails g capistrano:nginx_puma:config

if your nginx server configuration is not located in /etc/nginx, you may need to customize:

set :nginx_sites_available_path, "/etc/nginx/sites-available"
set :nginx_sites_enabled_path, "/etc/nginx/sites-enabled"

By default, nginx_config will be executed with :web role. But you can assign it to a different role:

set :puma_nginx, :foo

or define a standalone one:

role :puma_nginx, %w{[email protected]}

Jungle

For Jungle tasks (beta), these options exist:

    set :puma_jungle_conf, '/etc/puma.conf'
    set :puma_run_path, '/usr/local/bin/run-puma'

Multi bind

Multi-bind can be set with an array in the puma_bind variable

  set :puma_bind, %w(tcp://0.0.0.0:9292 unix:///tmp/puma.sock)
* Listening on tcp://0.0.0.0:9220
* Listening on unix:///tmp/puma.sock

Active Record

For ActiveRecord the following line to your deploy.rb

    set :puma_init_active_record, true

Other configs

Configurable options, shown here with defaults: Please note the configuration options below are not required unless you are trying to override a default setting, for instance if you are deploying on a host on which you do not have sudo or root privileges and you need to restrict the path. These settings go in the deploy.rb file.

    set :puma_user, fetch(:user)
    set :puma_rackup, -> { File.join(current_path, 'config.ru') }
    set :puma_state, "#{shared_path}/tmp/pids/puma.state"
    set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
    set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"    #accept array for multi-bind
    set :puma_default_control_app, "unix://#{shared_path}/tmp/sockets/pumactl.sock"
    set :puma_conf, "#{shared_path}/puma.rb"
    set :puma_access_log, "#{shared_path}/log/puma_access.log"
    set :puma_error_log, "#{shared_path}/log/puma_error.log"
    set :puma_role, :app
    set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
    set :puma_threads, [0, 16]
    set :puma_workers, 0
    set :puma_worker_timeout, nil
    set :puma_init_active_record, false
    set :puma_preload_app, false
    set :puma_plugins, []  #accept array of plugins
    set :nginx_use_ssl, false

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Releases

  • 1.2.1 - August 20, 2015 19:18
  • 1.2.0 - August 19, 2015 11:29
  • 1.1.0 - June 23, 2015 20:32
  • 1.0.0 - May 05, 2015 14:57
  • 0.9.0 - March 20, 2015 18:42
  • 0.8.5 - January 30, 2015 09:34
  • 0.8.4 - January 25, 2015 07:38
  • 0.8.3 - October 28, 2014 16:06
  • 0.8.2 - October 17, 2014 15:32
  • 0.8.1 - October 08, 2014 13:44
See all 27 releases

Project Statistics

SourceRank 15
Dependencies 2
Dependent projects 1
Dependent repositories 776
Total releases 27
Latest release
First release
Stars 341
Forks 168
Watchers 12
Contributors 46
Repo Size: 218 KB

Top Contributors See all

Abdelkader Boudih ruohan.chen Hnat Kubov molfar fang duan Michael C. Beck Cyril Rohr Jun Lin Huang Bin Lonre Wang Simon Males Jordan Hollinger soylent Ivan Schneider ayaya Bryan Liles Rafael Goulart Nikolay Ponomarev Vladimir Kochnev Suraj Shirvankar

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2016-11-15 07:06:26 UTC

Login to resync this project