capistrano3-puma 3.0.2 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +14 -7
- data/CONTRIBUTORS.md +46 -52
- data/LICENSE.txt +1 -1
- data/README.md +65 -5
- data/capistrano3-puma.gemspec +3 -3
- data/lib/capistrano/puma.rb +9 -5
- data/lib/capistrano/puma/daemon.rb +13 -0
- data/lib/capistrano/puma/jungle.rb +4 -12
- data/lib/capistrano/puma/monit.rb +6 -3
- data/lib/capistrano/puma/nginx.rb +2 -0
- data/lib/capistrano/puma/systemd.rb +19 -0
- data/lib/capistrano/puma/version.rb +1 -1
- data/lib/capistrano/puma/workers.rb +3 -1
- data/lib/capistrano/tasks/daemon.rake +66 -0
- data/lib/capistrano/tasks/jungle.rake +13 -4
- data/lib/capistrano/tasks/monit.rake +9 -7
- data/lib/capistrano/tasks/puma.rake +0 -79
- data/lib/capistrano/tasks/systemd.rake +59 -0
- data/lib/capistrano/tasks/workers.rake +6 -3
- data/lib/capistrano/templates/nginx_conf.erb +24 -4
- data/lib/capistrano/templates/puma-deb.erb +167 -82
- data/lib/capistrano/templates/puma.rb.erb +3 -1
- data/lib/capistrano/templates/puma.service.erb +18 -0
- data/lib/capistrano/templates/run-puma.erb +17 -6
- metadata +24 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e9e8a658109b9d4bae5177d3fe539a2354c343904916a779cc2e9a16ad337cf2
|
4
|
+
data.tar.gz: f70546d3675eeb4fc0998574f07c75355f25e236c2f53d45a187ae75babac5c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d16d5ac8433ab8aa783efaffa734b0b8843034f349727cec57c5d9f47e247d7ef38afdcddb4f8bc08ef465c69153fc51aa94969b3c8fb85ffe40373a93665182
|
7
|
+
data.tar.gz: e8be34856e21d6ed840f9fe9d72428a11668b239f60aeb1b4ae1eff66661cb793fe284884f97a41d76dee43b0573fb55bf3acce45ea79de810f3032f1057bb12
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
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
|
data/CONTRIBUTORS.md
CHANGED
@@ -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
|
-
|
14
|
-
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
Neil Bartley
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
data/LICENSE.txt
CHANGED
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.
|
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:
|
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,
|
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
|
data/capistrano3-puma.gemspec
CHANGED
@@ -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::
|
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' , '
|
23
|
+
spec.add_dependency 'puma' , '>= 4.0', '< 6.0'
|
24
24
|
spec.post_install_message = %q{
|
25
|
-
|
25
|
+
All plugins need to be explicitly installed with install_plugin.
|
26
26
|
Please see README.md
|
27
27
|
}
|
28
28
|
end
|
data/lib/capistrano/puma.rb
CHANGED
@@ -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
|
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
|
@@ -11,20 +11,12 @@ module Capistrano
|
|
11
11
|
eval_rakefile File.expand_path('../../tasks/jungle.rake', __FILE__)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
def debian_install
|
17
|
-
template_puma 'puma-deb', "#{fetch(:tmp_dir)}/puma", @role
|
18
|
-
execute "chmod +x #{fetch(:tmp_dir)}/puma"
|
19
|
-
sudo "mv #{fetch(:tmp_dir)}/puma /etc/init.d/puma"
|
20
|
-
sudo 'update-rc.d -f puma defaults'
|
14
|
+
def debian_install(role)
|
15
|
+
template_puma 'puma-deb', "#{fetch(:tmp_dir)}/puma", role
|
21
16
|
end
|
22
17
|
|
23
|
-
def rhel_install
|
24
|
-
template_puma 'puma-rpm', "#{fetch(:tmp_dir)}/puma",
|
25
|
-
execute "chmod +x #{fetch(:tmp_dir)}/puma"
|
26
|
-
sudo "mv #{fetch(:tmp_dir)}/puma /etc/init.d/puma"
|
27
|
-
sudo 'chkconfig --add puma'
|
18
|
+
def rhel_install(role)
|
19
|
+
template_puma 'puma-rpm', "#{fetch(:tmp_dir)}/puma", role
|
28
20
|
end
|
29
21
|
end
|
30
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
|
-
|
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
|