capistrano3-puma 3.0.3 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 55d549d7cb3e0dbaeec810b62a92d8849b2dc8b4
4
- data.tar.gz: 53ee26a9429adca7d5d333393ba93c9439398f55
2
+ SHA256:
3
+ metadata.gz: cad406687f84be23ff2edd61bb91364edc39ff94f5e001c094347c1f866179ef
4
+ data.tar.gz: 0f53bc47393eb0572c5d4afb350225df5488f818ac87b72ef6b3ee46406b4697
5
5
  SHA512:
6
- metadata.gz: 9cc4f3473a175e4c74af3244c8b5e758626db8b556bdd0c72501b7053a2995ddecd18c3f0b42eb5764b6e948d73f8b62274e012e4171ca701ce03508b618b30d
7
- data.tar.gz: e9669146b2f239bd934ac1b014e4e24af981b78325accdba11dc2f1c2c8191c1aec2a331cda7c24d1323bbd2fb61ff6cd01c4bc5751b39080950169b0ea579aa
6
+ metadata.gz: a0deb71b4833e0f7a4b8b83dc0c0913e1060d039595c8acffedeb2b8bf34e7f83c703827728806d98cc5f943238c42079a1962d34b629dbd5c9c1eb5d9088e4d
7
+ data.tar.gz: 8207cd79c5265437cccaf6c1ac8fabdfca2b9d82600fcd69b8ad1aedb9442729e3d778a96fd7fa5835ff9bb9555b75d8d1374367eb46b4e0835f5d2e7b401ec0
@@ -1,14 +1,21 @@
1
1
  ## Changelog
2
+ - 5.0.0:
3
+ - Support puma 5.0
4
+ - Support SystemD service manager
5
+ - 4.0.0:
6
+ - Support puma 4.x
7
+ - 3.1.0:
8
+ - Don't load puma hooks by default.
2
9
  - 3.0.0:
3
- - Require capistrano 3.7+
4
- - Implement the plugin system
5
- - don't fail if puma was already running
6
- - Added :puma_daemonize option (default is false)
10
+ - Require capistrano 3.7+
11
+ - Implement the plugin system
12
+ - don't fail if puma was already running
13
+ - Added :puma_daemonize option (default is false)
7
14
 
8
15
  - 2.0.0:
9
- - Require puma 3.4+
10
- - Require Capistrano 3.5+
11
- - Require capistrano-bundler
16
+ - Require puma 3.4+
17
+ - Require Capistrano 3.5+
18
+ - Require capistrano-bundler
12
19
 
13
20
  - 1.2.0: add support for puma user for puma user @mcb & @seuros
14
21
  - 1.1.0: Set :puma_preload_app to false; Reload Monit after uploading any monit configuration; Always refresh Gemfile @rafaelgoulart @suhailpatel @sime
@@ -1,54 +1,48 @@
1
1
  ## Contributors
2
2
 
3
- Abdelkader Boudih
4
- André Arko
5
- Ariel Zerahia
6
- Barack Obama
7
- Bart de Water
8
- Benjamin Kim
9
- Bin Huang
10
- Bryan Liles
11
- Claudio Poli
12
- Cyril Rohr
13
- Eric
14
- Fritz Lee
15
- Hnat Kubov
16
- Ivan Schneider
17
- James-Hendrickson
18
- Jens Hausherr
19
- Jeremy Rottman
20
- Jesse Cooke
21
- Johan Lind
22
- Jordan Hollinger
23
- Jun Lin
24
- Kamil Giszczak
25
- Kevin Collignon
26
- Konstantin Papkovskiy
27
- Kyle Decot
28
- Lisa Hagemann
29
- Lonre Wang
30
- Lucas Alves
31
- Marcos Chicote
32
- Matias De Santi
33
- Michael C. Beck
34
- Molfar
35
- Neil Bartley
36
- Peter
37
- Philippe Nénert
38
- Ponomarev Nikolay
39
- Rafael Goulart
40
- RavWar
41
- Ruslan
42
- SHIMADA Koji
43
- Sergey Ponomarev
44
- Shane O'Grady
45
- Simon Males
46
- Steve Madere
47
- Suhail Patel
48
- Suraj Shirvankar
49
- ayaya
50
- dfang
51
- marshall-lee
52
- mizukmb
53
- msbrigna
54
- ruohan.chen
3
+ - Abdelkader Boudih
4
+ - André Arko
5
+ - Ariel Zerahia
6
+ - Barack Obama
7
+ - Bart de Water
8
+ - Benjamin Kim
9
+ - Bin Huang
10
+ - Bryan Liles
11
+ - Claudio Poli
12
+ - Cyril Rohr
13
+ - Fritz Lee
14
+ - Feña Agar
15
+ - Hnat Kubov
16
+ - Ivan Schneider
17
+ - James-Hendrickson
18
+ - Jens Hausherr
19
+ - Jeremy Rottman
20
+ - Jesse Cooke
21
+ - Johan Lind
22
+ - Jordan Hollinger
23
+ - Jun Lin
24
+ - Kamil Giszczak
25
+ - Kevin Collignon
26
+ - Konstantin Papkovskiy
27
+ - Kyle Decot
28
+ - Lisa Hagemann
29
+ - Lonre Wang
30
+ - Lucas Alves
31
+ - Marcos Chicote
32
+ - Mario Celit log
33
+ - Matias De Santi
34
+ - Michael C. Beck
35
+ - Neil Bartley
36
+ - Philippe Nénert
37
+ - Ponomarev Nikolay
38
+ - Rafael Goulart
39
+ - SHIMADA Koji
40
+ - Sergey Ponomarev
41
+ - Shane O'Grady
42
+ - Simon Males
43
+ - Steve Madere
44
+ - Suhail Patel
45
+ - Suraj Shirvankar
46
+ - marshall-lee
47
+ - ruohan chen
48
+ - ayaya zhao
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013-2017 Abdelkader Boudih
3
+ Copyright (c) 2013-2020 Abdelkader Boudih
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -20,11 +20,38 @@ And then execute:
20
20
  # Capfile
21
21
 
22
22
  require 'capistrano/puma'
23
+ install_plugin Capistrano::Puma # Default puma tasks
23
24
  install_plugin Capistrano::Puma::Workers # if you want to control the workers (in cluster mode)
24
25
  install_plugin Capistrano::Puma::Jungle # if you need the jungle tasks
25
26
  install_plugin Capistrano::Puma::Monit # if you need the monit tasks
26
27
  install_plugin Capistrano::Puma::Nginx # if you want to upload a nginx site template
27
28
  ```
29
+ You will need to select your service manager
30
+ ```ruby
31
+ install_plugin Capistrano::Puma::Daemon # If you using puma daemonized (not supported in Puma 5+)
32
+ ```
33
+ or
34
+ ```ruby
35
+ install_plugin Capistrano::Puma::Systemd # if you use SystemD
36
+ ```
37
+
38
+ To prevent loading the hooks of the plugin, add false to the load_hooks param.
39
+ ```ruby
40
+ # Capfile
41
+
42
+ require 'capistrano/puma'
43
+ install_plugin Capistrano::Puma, load_hooks: false # Default puma tasks without hooks
44
+ install_plugin Capistrano::Puma::Monit, load_hooks: false # Monit tasks without hooks
45
+ ```
46
+
47
+ To make it work with rvm, rbenv and chruby, install the plugin after corresponding library inclusion.
48
+ ```ruby
49
+ # Capfile
50
+
51
+ require 'capistrano/rbenv'
52
+ require 'capistrano/puma'
53
+ install_plugin Capistrano::Puma
54
+ ```
28
55
 
29
56
  ### Config
30
57
 
@@ -32,9 +59,9 @@ To list available tasks use `cap -T`
32
59
 
33
60
  To upload puma config use:
34
61
  ```ruby
35
- cap puma:config
62
+ cap production puma:config
36
63
  ```
37
- By default the file located in `shared/puma.config`
64
+ By default the file located in `shared/puma.rb`
38
65
 
39
66
 
40
67
  Ensure that `tmp/pids` and ` tmp/sockets log` are shared (via `linked_dirs`):
@@ -45,7 +72,7 @@ Ensure that `tmp/pids` and ` tmp/sockets log` are shared (via `linked_dirs`):
45
72
 
46
73
  To upload a nginx site config (eg. /etc/nginx/sites-enabled/) use:
47
74
  ```ruby
48
- cap puma:nginx_config
75
+ cap production puma:nginx_config
49
76
  ```
50
77
 
51
78
  To customize these two templates locally before uploading use:
@@ -76,13 +103,26 @@ For Jungle tasks (beta), these options exist:
76
103
  set :puma_run_path, '/usr/local/bin/run-puma'
77
104
  ```
78
105
 
106
+ ### Systemd
107
+
108
+ Install Systemd plugin in `Capfile`:
109
+ ```ruby
110
+ install_plugin Capistrano::Puma
111
+ install_plugin Capistrano::Puma::Systemd
112
+ ```
113
+
114
+ To generate unit file use:
115
+ ```
116
+ cap production puma:systemd:config puma:systemd:enable
117
+ ```
118
+
79
119
  ### Multi bind
80
120
 
81
121
  Multi-bind can be set with an array in the puma_bind variable
82
122
  ```ruby
83
123
  set :puma_bind, %w(tcp://0.0.0.0:9292 unix:///tmp/puma.sock)
84
124
  ```
85
- * Listening on tcp://0.0.0.0:9220
125
+ * Listening on tcp://0.0.0.0:9292
86
126
  * Listening on unix:///tmp/puma.sock
87
127
 
88
128
  ### Active Record
@@ -102,6 +142,7 @@ Configurable options, shown here with defaults: Please note the configuration op
102
142
  set :puma_state, "#{shared_path}/tmp/pids/puma.state"
103
143
  set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
104
144
  set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array for multi-bind
145
+ set :puma_control_app, false
105
146
  set :puma_default_control_app, "unix://#{shared_path}/tmp/sockets/pumactl.sock"
106
147
  set :puma_conf, "#{shared_path}/puma.rb"
107
148
  set :puma_access_log, "#{shared_path}/log/puma_access.log"
@@ -113,9 +154,28 @@ Configurable options, shown here with defaults: Please note the configuration op
113
154
  set :puma_worker_timeout, nil
114
155
  set :puma_init_active_record, false
115
156
  set :puma_preload_app, false
116
- set :puma_daemonize, true
157
+ set :puma_daemonize, false
117
158
  set :puma_plugins, [] #accept array of plugins
159
+ set :puma_tag, fetch(:application)
160
+ set :puma_restart_command, 'bundle exec puma'
161
+
162
+ set :nginx_config_name, "#{fetch(:application)}_#{fetch(:stage)}"
163
+ set :nginx_flags, 'fail_timeout=0'
164
+ set :nginx_http_flags, fetch(:nginx_flags)
165
+ set :nginx_server_name, "localhost #{fetch(:application)}.local"
166
+ set :nginx_sites_available_path, '/etc/nginx/sites-available'
167
+ set :nginx_sites_enabled_path, '/etc/nginx/sites-enabled'
168
+ set :nginx_socket_flags, fetch(:nginx_flags)
169
+ set :nginx_ssl_certificate, "/etc/ssl/certs/#{fetch(:nginx_config_name)}.crt"
170
+ set :nginx_ssl_certificate_key, "/etc/ssl/private/#{fetch(:nginx_config_name)}.key"
118
171
  set :nginx_use_ssl, false
172
+ set :nginx_use_http2, true
173
+ set :nginx_downstream_uses_ssl, false
174
+ ```
175
+
176
+ __Notes:__ If you are setting values for variables that might be used by other plugins, use `append` instead of `set`. For example:
177
+ ```ruby
178
+ append :rbenv_map_bins, 'puma', 'pumactl'
119
179
  ```
120
180
 
121
181
  ## Contributing
@@ -5,7 +5,7 @@ require 'capistrano/puma/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'capistrano3-puma'
8
- spec.version = Capistrano::PumaVERSION
8
+ spec.version = Capistrano::PUMAVERSION
9
9
  spec.authors = ['Abdelkader Boudih']
10
10
  spec.email = ['Terminale@gmail.com']
11
11
  spec.description = %q{Puma integration for Capistrano 3}
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'capistrano', '~> 3.7'
22
22
  spec.add_dependency 'capistrano-bundler'
23
- spec.add_dependency 'puma' , '~> 3.4'
23
+ spec.add_dependency 'puma' , '>= 4.0', '< 6.0'
24
24
  spec.post_install_message = %q{
25
- [capistrano-puma] Plugins need to be explicitly installed with install_plugin.
25
+ All plugins need to be explicitly installed with install_plugin.
26
26
  Please see README.md
27
27
  }
28
28
  end
@@ -8,7 +8,7 @@ module Capistrano
8
8
  if user == role.user
9
9
  block.call
10
10
  else
11
- as user do
11
+ backend.as user do
12
12
  block.call
13
13
  end
14
14
  end
@@ -42,6 +42,7 @@ module Capistrano
42
42
  "config/deploy/templates/#{from}.rb",
43
43
  "config/deploy/templates/#{from}.erb",
44
44
  File.expand_path("../templates/#{from}.erb", __FILE__),
45
+ File.expand_path("../templates/#{from}.rb.erb", __FILE__)
45
46
  ].detect { |path| File.file?(path) }
46
47
  erb = File.read(file)
47
48
  backend.upload! StringIO.new(ERB.new(erb, nil, '-').result(binding)), to
@@ -66,6 +67,7 @@ module Capistrano
66
67
  set_if_empty :puma_state, -> { File.join(shared_path, 'tmp', 'pids', 'puma.state') }
67
68
  set_if_empty :puma_pid, -> { File.join(shared_path, 'tmp', 'pids', 'puma.pid') }
68
69
  set_if_empty :puma_bind, -> { File.join("unix://#{shared_path}", 'tmp', 'sockets', 'puma.sock') }
70
+ set_if_empty :puma_control_app, false
69
71
  set_if_empty :puma_default_control_app, -> { File.join("unix://#{shared_path}", 'tmp', 'sockets', 'pumactl.sock') }
70
72
  set_if_empty :puma_conf, -> { File.join(shared_path, 'puma.rb') }
71
73
  set_if_empty :puma_access_log, -> { File.join(shared_path, 'log', 'puma_access.log') }
@@ -73,6 +75,8 @@ module Capistrano
73
75
  set_if_empty :puma_init_active_record, false
74
76
  set_if_empty :puma_preload_app, false
75
77
  set_if_empty :puma_daemonize, false
78
+ set_if_empty :puma_tag, ''
79
+ set_if_empty :puma_restart_command, 'bundle exec puma'
76
80
 
77
81
  # Chruby, Rbenv and RVM integration
78
82
  append :chruby_map_bins, 'puma', 'pumactl'
@@ -85,7 +89,6 @@ module Capistrano
85
89
 
86
90
  def register_hooks
87
91
  after 'deploy:check', 'puma:check'
88
- after 'deploy:finished', 'puma:smart_restart'
89
92
  end
90
93
 
91
94
  def puma_workers
@@ -107,13 +110,14 @@ module Capistrano
107
110
  end
108
111
 
109
112
  def upload_puma_rb(role)
110
- template_puma 'puma.rb', fetch(:puma_conf), role
113
+ template_puma 'puma', fetch(:puma_conf), role
111
114
  end
112
115
  end
113
116
  end
114
- install_plugin Capistrano::Puma
115
117
 
116
118
  require 'capistrano/puma/workers'
119
+ require 'capistrano/puma/daemon'
120
+ require 'capistrano/puma/systemd'
117
121
  require 'capistrano/puma/monit'
118
122
  require 'capistrano/puma/jungle'
119
- require 'capistrano/puma/nginx'
123
+ require 'capistrano/puma/nginx'
@@ -0,0 +1,13 @@
1
+ module Capistrano
2
+ class Puma::Daemon < Capistrano::Plugin
3
+ include PumaCommon
4
+
5
+ def register_hooks
6
+ after 'deploy:finished', 'puma:smart_restart'
7
+ end
8
+
9
+ def define_tasks
10
+ eval_rakefile File.expand_path('../../tasks/daemon.rake', __FILE__)
11
+ end
12
+ end
13
+ end
@@ -13,16 +13,10 @@ module Capistrano
13
13
 
14
14
  def debian_install(role)
15
15
  template_puma 'puma-deb', "#{fetch(:tmp_dir)}/puma", role
16
- execute "chmod +x #{fetch(:tmp_dir)}/puma"
17
- sudo "mv #{fetch(:tmp_dir)}/puma /etc/init.d/puma"
18
- sudo 'update-rc.d -f puma defaults'
19
16
  end
20
17
 
21
18
  def rhel_install(role)
22
19
  template_puma 'puma-rpm', "#{fetch(:tmp_dir)}/puma", role
23
- execute "chmod +x #{fetch(:tmp_dir)}/puma"
24
- sudo "mv #{fetch(:tmp_dir)}/puma /etc/init.d/puma"
25
- sudo 'chkconfig --add puma'
26
20
  end
27
21
  end
28
22
  end
@@ -22,10 +22,13 @@ module Capistrano
22
22
 
23
23
  def sudo_if_needed(command)
24
24
  if fetch(:puma_monit_use_sudo)
25
- sudo command
25
+ backend.sudo command
26
26
  else
27
- execute command
27
+ puma_role = fetch(:puma_role)
28
+ backend.on(puma_role) do
29
+ backend.execute command
30
+ end
28
31
  end
29
32
  end
30
33
  end
31
- end
34
+ end
@@ -11,6 +11,8 @@ module Capistrano
11
11
  set_if_empty :nginx_http_flags, fetch(:nginx_flags)
12
12
  set_if_empty :nginx_socket_flags, fetch(:nginx_flags)
13
13
  set_if_empty :nginx_use_ssl, false
14
+ set_if_empty :nginx_use_http2, true
15
+ set_if_empty :nginx_downstream_uses_ssl, false
14
16
  end
15
17
 
16
18
  def define_tasks
@@ -0,0 +1,19 @@
1
+ module Capistrano
2
+ class Puma::Systemd < Capistrano::Plugin
3
+ include PumaCommon
4
+
5
+ def register_hooks
6
+ after 'deploy:finished', 'puma:restart'
7
+ end
8
+
9
+ def define_tasks
10
+ eval_rakefile File.expand_path('../../tasks/systemd.rake', __FILE__)
11
+ end
12
+
13
+ def set_defaults
14
+ set_if_empty :puma_systemd_conf_dir, '/etc/systemd/system'
15
+ set_if_empty :puma_systemctl_bin, '/bin/systemctl'
16
+ set_if_empty :puma_service_unit_name, 'puma'
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Capistrano
2
- PumaVERSION = '3.0.3'
2
+ PUMAVERSION = '5.0.0'
3
3
  end
@@ -1,7 +1,9 @@
1
1
  module Capistrano
2
2
  class Puma::Workers < Capistrano::Plugin
3
+ include PumaCommon
4
+
3
5
  def define_tasks
4
6
  eval_rakefile File.expand_path('../../tasks/workers.rake', __FILE__)
5
7
  end
6
8
  end
7
- end
9
+ end