capistrano3-puma 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/CONTRIBUTORS.md +45 -0
- data/LICENSE.txt +1 -1
- data/README.md +54 -80
- data/capistrano3-puma.gemspec +3 -2
- data/lib/capistrano/puma.rb +1 -0
- data/lib/capistrano/puma/version.rb +1 -1
- data/lib/capistrano/tasks/monit.rake +12 -3
- data/lib/capistrano/tasks/nginx.rake +13 -0
- data/lib/capistrano/tasks/puma.rake +26 -21
- data/lib/capistrano/tasks/workers.rake +3 -3
- data/lib/capistrano/templates/nginx_conf.erb +13 -18
- data/lib/capistrano/templates/puma.rb.erb +6 -0
- data/lib/capistrano/templates/puma_monit.conf.erb +2 -2
- metadata +24 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28c9c75dc6f8d76315e7c45f93ae6bd942057082
|
4
|
+
data.tar.gz: 7853f2ad6ded69548d582ab4e1d7ec8b8d537955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cf44c290adb44ccaa6a600426e25afb8a24e063cc3dd64c6f1fc154fea4c7aca19b700221e7d885fcc32305b3bf5f78419d15730639d98d9e7fe17e8a54d3ec
|
7
|
+
data.tar.gz: 17b823002d40963e1d67a6e968f59d96ab108627bda03d7af9275bcf31773de254620ca0daf86fe70eaf0da37712b30628d1ff9a0e022becc1068b409beac292
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
## Changelog
|
2
|
+
- 2.0.0:
|
3
|
+
- Require puma 3.4+
|
4
|
+
- Require Capistrano 3.5+
|
5
|
+
- Require capistrano-bundler
|
6
|
+
|
7
|
+
- 1.2.0: add support for puma user for puma user @mcb & @seuros
|
8
|
+
- 1.1.0: Set :puma_preload_app to false; Reload Monit after uploading any monit configuration; Always refresh Gemfile @rafaelgoulart @suhailpatel @sime
|
9
|
+
- 1.0.0: Add activate control app @askagirl
|
10
|
+
- 0.8.5: Fix smart_restart task to check if puma preloads app
|
11
|
+
- 0.8.4: Allow patch method (Nginx template) @lonre
|
12
|
+
- 0.8.2: Start task creates a conf file if none exists @stevemadere
|
13
|
+
- 0.8.1: Fixed nginx task @hnatt, support for prune_bundler @behe
|
14
|
+
- 0.8.0: Some changes
|
15
|
+
- 0.7.0: added Nginx template generator @dfang
|
16
|
+
- 0.6.1: added :puma_default_hooks, you can turn off the automatic hooks by setting it false
|
17
|
+
- 0.6.0: Remove `daemonize true` from default puma.rb file. Explicitly pass `--daemon` flag when needed.
|
18
|
+
- 0.5.1: Added worker_timeout option
|
19
|
+
- 0.5.0: Bugs fixes
|
20
|
+
- 0.4.2: Fix monit template to support chruby
|
21
|
+
- 0.4.1: Fix puma jungle (debian)
|
22
|
+
- 0.4.0: Multi-bind support
|
23
|
+
- 0.3.7: Dependency bug fix
|
24
|
+
- 0.3.5: Fixed a prehistoric bug
|
25
|
+
- 0.3.4: I don't remember what i did here
|
26
|
+
- 0.3.3: Puma jungle start fix
|
27
|
+
- 0.3.2: Tag option support (require puma 2.8.2+)
|
28
|
+
- 0.3.1: Typo fix
|
29
|
+
- 0.3.0: Initial support for puma signals
|
30
|
+
- 0.2.2: Application pre-loading is optional now (set puma_preload_app to false to turn it off)
|
31
|
+
- 0.2.1: Tasks are run within rack context
|
32
|
+
- 0.2.0: Support for puma `ActiveRecord::Base.establish_connection` on
|
33
|
+
boot
|
34
|
+
- 0.1.3: Capistrano 3.1 support
|
35
|
+
- 0.1.2: Gemfile are refreshed between deploys now
|
36
|
+
- 0.1.1: Initial support for Monit and configuration override added.
|
37
|
+
- 0.1.0: Phased restart will be used if puma is in cluster mode
|
38
|
+
- 0.0.9: puma.rb location changed to shared_path root. puma:check moved to after deploy:check
|
39
|
+
- 0.0.8: puma.rb is automatically generated if not present. Fixed RVM issue.
|
40
|
+
- 0.0.7: Gem pushed to rubygems as capistrano3-puma. Support of Redhat based OS for Jungle init script.
|
data/CONTRIBUTORS.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
## Contributors
|
2
|
+
|
3
|
+
Abdelkader Boudih
|
4
|
+
André Arko
|
5
|
+
Ariel Zerahia
|
6
|
+
ayaya
|
7
|
+
Bin Huang
|
8
|
+
Bryan Liles
|
9
|
+
Claudio Poli
|
10
|
+
Cyril Rohr
|
11
|
+
dfang
|
12
|
+
Fritz Lee
|
13
|
+
Hnat Kubov
|
14
|
+
Ivan Schneider
|
15
|
+
James-Hendrickson
|
16
|
+
Jens Hausherr
|
17
|
+
Jeremy Rottman
|
18
|
+
Jesse Cooke
|
19
|
+
Johan Lind
|
20
|
+
Jordan Hollinger
|
21
|
+
Jun Lin
|
22
|
+
Kamil Giszczak
|
23
|
+
Kevin Collignon
|
24
|
+
Konstantin Papkovskiy
|
25
|
+
Kyle Decot
|
26
|
+
Lisa Hagemann
|
27
|
+
Lonre Wang
|
28
|
+
marshall-lee
|
29
|
+
Matias De Santi
|
30
|
+
Michael C. Beck
|
31
|
+
Molfar
|
32
|
+
msbrigna
|
33
|
+
Neil Bartley
|
34
|
+
Peter
|
35
|
+
Ponomarev Nikolay
|
36
|
+
Rafael Goulart
|
37
|
+
RavWar
|
38
|
+
ruohan.chen
|
39
|
+
Ruslan
|
40
|
+
Sergey Ponomarev
|
41
|
+
Shane O'Grady
|
42
|
+
Simon Males
|
43
|
+
Steve Madere
|
44
|
+
Suhail Patel
|
45
|
+
Suraj Shirvankar
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -26,58 +26,58 @@ And then execute:
|
|
26
26
|
require 'capistrano/puma/nginx' # if you want to upload a nginx site template
|
27
27
|
```
|
28
28
|
|
29
|
-
|
29
|
+
### Config
|
30
|
+
|
31
|
+
To list available tasks use `cap -T`
|
32
|
+
|
33
|
+
To upload puma config use:
|
34
|
+
```ruby
|
35
|
+
cap puma:config
|
30
36
|
```
|
31
|
-
|
32
|
-
|
37
|
+
By default the file located in `shared/puma.config`
|
38
|
+
|
39
|
+
|
40
|
+
Ensure that `tmp/pids` and ` tmp/sockets log` are shared (via `linked_dirs`):
|
41
|
+
|
42
|
+
`This step is mandatory before deploying, otherwise puma server won't start`
|
43
|
+
|
44
|
+
### Nginx
|
45
|
+
|
46
|
+
To upload a nginx site config (eg. /etc/nginx/sites-enabled/) use:
|
47
|
+
```ruby
|
48
|
+
cap puma:nginx_config
|
33
49
|
```
|
34
|
-
|
50
|
+
|
51
|
+
To customize these two templates locally before uploading use:
|
35
52
|
```
|
36
53
|
rails g capistrano:nginx_puma:config
|
37
54
|
```
|
38
55
|
|
39
|
-
if your nginx server configuration is not located in
|
40
|
-
```
|
56
|
+
if your nginx server configuration is not located in `/etc/nginx`, you may need to customize:
|
57
|
+
```ruby
|
41
58
|
set :nginx_sites_available_path, "/etc/nginx/sites-available"
|
42
59
|
set :nginx_sites_enabled_path, "/etc/nginx/sites-enabled"
|
43
60
|
```
|
44
61
|
|
45
|
-
By default,
|
46
|
-
```
|
62
|
+
By default, `nginx_config` will be executed with `:web` role. But you can assign it to a different role:
|
63
|
+
```ruby
|
47
64
|
set :puma_nginx, :foo
|
48
65
|
```
|
49
66
|
or define a standalone one:
|
50
|
-
```
|
67
|
+
```ruby
|
51
68
|
role :puma_nginx, %w{root@example.com}
|
52
69
|
```
|
53
70
|
|
54
|
-
|
71
|
+
### Jungle
|
55
72
|
|
56
|
-
```ruby
|
57
|
-
set :puma_user, fetch(:user)
|
58
|
-
set :puma_rackup, -> { File.join(current_path, 'config.ru') }
|
59
|
-
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
|
60
|
-
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
|
61
|
-
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array for multi-bind
|
62
|
-
set :puma_default_control_app, "unix://#{shared_path}/tmp/sockets/pumactl.sock"
|
63
|
-
set :puma_conf, "#{shared_path}/puma.rb"
|
64
|
-
set :puma_access_log, "#{shared_path}/log/puma_access.log"
|
65
|
-
set :puma_error_log, "#{shared_path}/log/puma_error.log"
|
66
|
-
set :puma_role, :app
|
67
|
-
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
|
68
|
-
set :puma_threads, [0, 16]
|
69
|
-
set :puma_workers, 0
|
70
|
-
set :puma_worker_timeout, nil
|
71
|
-
set :puma_init_active_record, false
|
72
|
-
set :puma_preload_app, true
|
73
|
-
set :nginx_use_ssl, false
|
74
|
-
```
|
75
73
|
For Jungle tasks (beta), these options exist:
|
76
74
|
```ruby
|
77
75
|
set :puma_jungle_conf, '/etc/puma.conf'
|
78
76
|
set :puma_run_path, '/usr/local/bin/run-puma'
|
79
77
|
```
|
80
78
|
|
79
|
+
### Multi bind
|
80
|
+
|
81
81
|
Multi-bind can be set with an array in the puma_bind variable
|
82
82
|
```ruby
|
83
83
|
set :puma_bind, %w(tcp://0.0.0.0:9292 unix:///tmp/puma.sock)
|
@@ -85,63 +85,37 @@ Multi-bind can be set with an array in the puma_bind variable
|
|
85
85
|
* Listening on tcp://0.0.0.0:9220
|
86
86
|
* Listening on unix:///tmp/puma.sock
|
87
87
|
|
88
|
+
### Active Record
|
88
89
|
|
89
90
|
For ActiveRecord the following line to your deploy.rb
|
90
91
|
```ruby
|
91
92
|
set :puma_init_active_record, true
|
92
93
|
```
|
93
94
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
- 0.3.3: Puma jungle start fix
|
119
|
-
- 0.3.2: Tag option support (require puma 2.8.2+)
|
120
|
-
- 0.3.1: Typo fix
|
121
|
-
- 0.3.0: Initial support for puma signals
|
122
|
-
- 0.2.2: Application pre-loading is optional now (set puma_preload_app to false to turn it off)
|
123
|
-
- 0.2.1: Tasks are run within rack context
|
124
|
-
- 0.2.0: Support for puma `ActiveRecord::Base.establish_connection` on
|
125
|
-
boot
|
126
|
-
- 0.1.3: Capistrano 3.1 support
|
127
|
-
- 0.1.2: Gemfile are refreshed between deploys now
|
128
|
-
- 0.1.1: Initial support for Monit and configuration override added.
|
129
|
-
- 0.1.0: Phased restart will be used if puma is in cluster mode
|
130
|
-
- 0.0.9: puma.rb location changed to shared_path root. puma:check moved to after deploy:check
|
131
|
-
- 0.0.8: puma.rb is automatically generated if not present. Fixed RVM issue.
|
132
|
-
- 0.0.7: Gem pushed to rubygems as capistrano3-puma. Support of Redhat based OS for Jungle init script.
|
133
|
-
|
134
|
-
|
135
|
-
## Contributors
|
136
|
-
|
137
|
-
- [Ruohan Chen](https://github.com/crhan)
|
138
|
-
- [molfar](https://github.com/molfar)
|
139
|
-
- [ayaya](https://github.com/ayamomiji)
|
140
|
-
- [Shane O'Grady](https://github.com/shaneog)
|
141
|
-
- [Jun Lin](https://github.com/linjunpop)
|
142
|
-
- [fang duan](https://github.com/dfang)
|
143
|
-
- [Steve Madere](https://github.com/stevemadere)
|
144
|
-
- [Matias De Santi](https://github.com/mdesanti)
|
95
|
+
### Other configs
|
96
|
+
|
97
|
+
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.
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
set :puma_user, fetch(:user)
|
101
|
+
set :puma_rackup, -> { File.join(current_path, 'config.ru') }
|
102
|
+
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
|
103
|
+
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
|
104
|
+
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array for multi-bind
|
105
|
+
set :puma_default_control_app, "unix://#{shared_path}/tmp/sockets/pumactl.sock"
|
106
|
+
set :puma_conf, "#{shared_path}/puma.rb"
|
107
|
+
set :puma_access_log, "#{shared_path}/log/puma_access.log"
|
108
|
+
set :puma_error_log, "#{shared_path}/log/puma_error.log"
|
109
|
+
set :puma_role, :app
|
110
|
+
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
|
111
|
+
set :puma_threads, [0, 16]
|
112
|
+
set :puma_workers, 0
|
113
|
+
set :puma_worker_timeout, nil
|
114
|
+
set :puma_init_active_record, false
|
115
|
+
set :puma_preload_app, false
|
116
|
+
set :puma_plugins, [] #accept array of plugins
|
117
|
+
set :nginx_use_ssl, false
|
118
|
+
```
|
145
119
|
|
146
120
|
## Contributing
|
147
121
|
|
data/capistrano3-puma.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.files = `git ls-files`.split($/)
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'capistrano', '~> 3.
|
22
|
-
spec.add_dependency '
|
21
|
+
spec.add_dependency 'capistrano', '~> 3.5'
|
22
|
+
spec.add_dependency 'capistrano-bundler'
|
23
|
+
spec.add_dependency 'puma' , '~> 3.4'
|
23
24
|
end
|
data/lib/capistrano/puma.rb
CHANGED
@@ -21,14 +21,23 @@ namespace :puma do
|
|
21
21
|
desc 'Monitor Puma monit-service'
|
22
22
|
task :monitor do
|
23
23
|
on roles(fetch(:puma_role)) do
|
24
|
-
|
24
|
+
begin
|
25
|
+
sudo_if_needed "#{fetch(:puma_monit_bin)} monitor #{puma_monit_service_name}"
|
26
|
+
rescue
|
27
|
+
invoke 'puma:monit:config'
|
28
|
+
sudo_if_needed "#{fetch(:puma_monit_bin)} monitor #{puma_monit_service_name}"
|
29
|
+
end
|
25
30
|
end
|
26
31
|
end
|
27
32
|
|
28
33
|
desc 'Unmonitor Puma monit-service'
|
29
34
|
task :unmonitor do
|
30
35
|
on roles(fetch(:puma_role)) do
|
31
|
-
|
36
|
+
begin
|
37
|
+
sudo_if_needed "#{fetch(:puma_monit_bin)} unmonitor #{puma_monit_service_name}"
|
38
|
+
rescue
|
39
|
+
# no worries here (still no monitoring)
|
40
|
+
end
|
32
41
|
end
|
33
42
|
end
|
34
43
|
|
@@ -69,4 +78,4 @@ namespace :puma do
|
|
69
78
|
end
|
70
79
|
|
71
80
|
end
|
72
|
-
end
|
81
|
+
end
|
@@ -1,3 +1,16 @@
|
|
1
|
+
namespace :load do
|
2
|
+
task :defaults do
|
3
|
+
# Nginx and puma configuration
|
4
|
+
set :nginx_config_name, -> { "#{fetch(:application)}_#{fetch(:stage)}" }
|
5
|
+
set :nginx_sites_available_path, -> { '/etc/nginx/sites-available' }
|
6
|
+
set :nginx_sites_enabled_path, -> { '/etc/nginx/sites-enabled' }
|
7
|
+
set :nginx_server_name, -> { "localhost #{fetch(:application)}.local" }
|
8
|
+
set :nginx_flags, -> { 'fail_timeout=0' }
|
9
|
+
set :nginx_http_flags, -> { fetch(:nginx_flags) }
|
10
|
+
set :nginx_socket_flags, -> { fetch(:nginx_flags) }
|
11
|
+
set :nginx_use_ssl, false
|
12
|
+
end
|
13
|
+
end
|
1
14
|
namespace :puma do
|
2
15
|
desc 'Setup nginx configuration'
|
3
16
|
task :nginx_config do
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
namespace :load do
|
3
2
|
task :defaults do
|
4
3
|
set :puma_default_hooks, -> { true }
|
@@ -19,19 +18,13 @@ namespace :load do
|
|
19
18
|
set :puma_init_active_record, false
|
20
19
|
set :puma_preload_app, false
|
21
20
|
|
22
|
-
# Rbenv and RVM integration
|
23
|
-
|
24
|
-
|
21
|
+
# Chruby, Rbenv and RVM integration
|
22
|
+
append :chruby_map_bins, 'puma', 'pumactl'
|
23
|
+
append :rbenv_map_bins, 'puma', 'pumactl'
|
24
|
+
append :rvm_map_bins, 'puma', 'pumactl'
|
25
25
|
|
26
|
-
#
|
27
|
-
|
28
|
-
set :nginx_sites_available_path, -> { '/etc/nginx/sites-available' }
|
29
|
-
set :nginx_sites_enabled_path, -> { '/etc/nginx/sites-enabled' }
|
30
|
-
set :nginx_server_name, -> { "localhost #{fetch(:application)}.local" }
|
31
|
-
set :nginx_flags, -> { 'fail_timeout=0' }
|
32
|
-
set :nginx_http_flags, -> { fetch(:nginx_flags) }
|
33
|
-
set :nginx_socket_flags, -> { fetch(:nginx_flags) }
|
34
|
-
set :nginx_use_ssl, false
|
26
|
+
# Bundler integration
|
27
|
+
append :bundle_bins, 'puma', 'pumactl'
|
35
28
|
end
|
36
29
|
end
|
37
30
|
|
@@ -59,9 +52,14 @@ namespace :puma do
|
|
59
52
|
else
|
60
53
|
invoke 'puma:config'
|
61
54
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
55
|
+
|
56
|
+
if test "[ -f #{fetch(:puma_pid)} ]" and test :kill, "-0 $( cat #{fetch(:puma_pid)} )"
|
57
|
+
info 'Already Puma is running'
|
58
|
+
else
|
59
|
+
within current_path do
|
60
|
+
with rack_env: fetch(:puma_env) do
|
61
|
+
execute :puma, "-C #{fetch(:puma_conf)} --daemon"
|
62
|
+
end
|
65
63
|
end
|
66
64
|
end
|
67
65
|
end
|
@@ -76,8 +74,8 @@ namespace :puma do
|
|
76
74
|
puma_switch_user(role) do
|
77
75
|
with rack_env: fetch(:puma_env) do
|
78
76
|
if test "[ -f #{fetch(:puma_pid)} ]"
|
79
|
-
if test
|
80
|
-
execute :
|
77
|
+
if test :kill, "-0 $( cat #{fetch(:puma_pid)} )"
|
78
|
+
execute :pumactl, "-S #{fetch(:puma_state)} -F #{fetch(:puma_conf)} #{command}"
|
81
79
|
else
|
82
80
|
# delete invalid pid file , process is not running.
|
83
81
|
execute :rm, fetch(:puma_pid)
|
@@ -100,9 +98,9 @@ namespace :puma do
|
|
100
98
|
within current_path do
|
101
99
|
puma_switch_user(role) do
|
102
100
|
with rack_env: fetch(:puma_env) do
|
103
|
-
if test "[ -f #{fetch(:puma_pid)} ]" and test
|
101
|
+
if test "[ -f #{fetch(:puma_pid)} ]" and test :kill, "-0 $( cat #{fetch(:puma_pid)} )"
|
104
102
|
# NOTE pid exist but state file is nonsense, so ignore that case
|
105
|
-
execute :
|
103
|
+
execute :pumactl, "-S #{fetch(:puma_state)} -F #{fetch(:puma_conf)} #{command}"
|
106
104
|
else
|
107
105
|
# Puma is not running or state file is not present : Run it
|
108
106
|
invoke 'puma:start'
|
@@ -149,6 +147,7 @@ namespace :puma do
|
|
149
147
|
def puma_user(role)
|
150
148
|
properties = role.properties
|
151
149
|
properties.fetch(:puma_user) || # local property for puma only
|
150
|
+
fetch(:puma_user) ||
|
152
151
|
properties.fetch(:run_as) || # global property across multiple capistrano gems
|
153
152
|
role.user
|
154
153
|
end
|
@@ -167,6 +166,12 @@ namespace :puma do
|
|
167
166
|
end.join("\n")
|
168
167
|
end
|
169
168
|
|
169
|
+
def puma_plugins
|
170
|
+
Array(fetch(:puma_plugins)).collect do |bind|
|
171
|
+
"plugin '#{bind}'"
|
172
|
+
end.join("\n")
|
173
|
+
end
|
174
|
+
|
170
175
|
def template_puma(from, to, role)
|
171
176
|
[
|
172
177
|
"lib/capistrano/templates/#{from}-#{role.hostname}-#{fetch(:stage)}.rb",
|
@@ -183,7 +188,7 @@ namespace :puma do
|
|
183
188
|
].each do |path|
|
184
189
|
if File.file?(path)
|
185
190
|
erb = File.read(path)
|
186
|
-
upload! StringIO.new(ERB.new(erb).result(binding)), to
|
191
|
+
upload! StringIO.new(ERB.new(erb, nil, '-').result(binding)), to
|
187
192
|
break
|
188
193
|
end
|
189
194
|
end
|
@@ -7,7 +7,7 @@ namespace :puma do
|
|
7
7
|
#TODO
|
8
8
|
# cleanup
|
9
9
|
# add host name/ip
|
10
|
-
workers_count = capture("ps ax | grep -c 'puma: cluster worker: `cat #{fetch(:puma_pid)}`'").to_i - 1
|
10
|
+
workers_count = capture("ps ax | grep -c 'puma: cluster worker [0-9]: `cat #{fetch(:puma_pid)}`'").to_i - 1
|
11
11
|
log "Workers count : #{workers_count}"
|
12
12
|
end
|
13
13
|
end
|
@@ -21,7 +21,7 @@ namespace :puma do
|
|
21
21
|
task :more do
|
22
22
|
on roles (fetch(:puma_role)) do |role|
|
23
23
|
puma_switch_user(role) do
|
24
|
-
execute(
|
24
|
+
execute(:kill, "-TTIN `cat #{fetch(:puma_pid)}`")
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -30,7 +30,7 @@ namespace :puma do
|
|
30
30
|
task :less do
|
31
31
|
on roles (fetch(:puma_role)) do |role|
|
32
32
|
puma_switch_user(role) do
|
33
|
-
execute(
|
33
|
+
execute(:kill, "-TTOU `cat #{fetch(:puma_pid)}`")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -1,32 +1,35 @@
|
|
1
1
|
upstream puma_<%= fetch(:nginx_config_name) %> { <%
|
2
|
-
flags = 'fail_timeout=0'
|
3
2
|
@backends = [fetch(:puma_bind)].flatten.map do |m|
|
4
3
|
etype, address = /(tcp|unix|ssl):\/{1,2}(.+)/.match(m).captures
|
5
|
-
if etype =='unix'
|
4
|
+
if etype == 'unix'
|
6
5
|
"server #{etype}:#{address} #{fetch(:nginx_socket_flags)};"
|
7
6
|
else
|
8
7
|
"server #{address.gsub(/0\.0\.0\.0(.+)/, "127.0.0.1\\1")} #{fetch(:nginx_http_flags)};"
|
9
8
|
end
|
10
9
|
end
|
11
|
-
%><% @backends.each do |server|
|
10
|
+
%><% @backends.each do |server| %>
|
12
11
|
<%= server %><% end %>
|
13
12
|
}
|
14
|
-
<% if fetch(:nginx_use_ssl)
|
13
|
+
<% if fetch(:nginx_use_ssl) -%>
|
15
14
|
server {
|
16
15
|
listen 80;
|
16
|
+
server_name <%= fetch(:nginx_server_name) %>;
|
17
17
|
rewrite ^(.*) https://$host$1 permanent;
|
18
18
|
}
|
19
|
-
<% end
|
19
|
+
<% end -%>
|
20
20
|
|
21
21
|
server {
|
22
|
-
<% if fetch(:nginx_use_ssl)
|
22
|
+
<% if fetch(:nginx_use_ssl) -%>
|
23
23
|
listen 443;
|
24
24
|
ssl on;
|
25
25
|
ssl_certificate /etc/ssl/certs/<%= fetch(:nginx_config_name) %>.crt;
|
26
26
|
ssl_certificate_key /etc/ssl/private/<%= fetch(:nginx_config_name) %>.key;
|
27
|
-
<% else
|
27
|
+
<% else -%>
|
28
28
|
listen 80;
|
29
|
-
<% end
|
29
|
+
<% end -%>
|
30
|
+
server_name <%= fetch(:nginx_server_name) %>;
|
31
|
+
root <%= current_path %>/public;
|
32
|
+
try_files $uri/index.html $uri @puma_<%= fetch(:nginx_config_name) %>;
|
30
33
|
|
31
34
|
client_max_body_size 4G;
|
32
35
|
keepalive_timeout 10;
|
@@ -34,17 +37,13 @@ server {
|
|
34
37
|
error_page 500 502 504 /500.html;
|
35
38
|
error_page 503 @503;
|
36
39
|
|
37
|
-
server_name <%= fetch(:nginx_server_name) %>;
|
38
|
-
root <%= current_path %>/public;
|
39
|
-
try_files $uri/index.html $uri @puma_<%= fetch(:nginx_config_name) %>;
|
40
|
-
|
41
40
|
location @puma_<%= fetch(:nginx_config_name) %> {
|
42
41
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
43
42
|
proxy_set_header Host $http_host;
|
44
43
|
proxy_redirect off;
|
45
|
-
<% if fetch(:nginx_use_ssl)
|
44
|
+
<% if fetch(:nginx_use_ssl) -%>
|
46
45
|
proxy_set_header X-Forwarded-Proto https;
|
47
|
-
<% end
|
46
|
+
<% end -%>
|
48
47
|
proxy_pass http://puma_<%= fetch(:nginx_config_name) %>;
|
49
48
|
# limit_req zone=one;
|
50
49
|
access_log <%= shared_path %>/log/nginx.access.log;
|
@@ -80,8 +79,4 @@ server {
|
|
80
79
|
if (-f $document_root/system/maintenance.html) {
|
81
80
|
return 503;
|
82
81
|
}
|
83
|
-
|
84
|
-
location ~ \.(php|html)$ {
|
85
|
-
return 405;
|
86
|
-
}
|
87
82
|
}
|
@@ -13,6 +13,8 @@ stdout_redirect '<%=fetch(:puma_access_log)%>', '<%=fetch(:puma_error_log)%>', t
|
|
13
13
|
|
14
14
|
threads <%=fetch(:puma_threads).join(',')%>
|
15
15
|
|
16
|
+
<%= puma_plugins %>
|
17
|
+
|
16
18
|
<%= puma_bind %>
|
17
19
|
<% if fetch(:puma_control_app) %>
|
18
20
|
activate_control_app "<%= fetch(:puma_default_control_app) %>"
|
@@ -34,6 +36,10 @@ on_restart do
|
|
34
36
|
end
|
35
37
|
|
36
38
|
<% if puma_preload_app? and fetch(:puma_init_active_record) %>
|
39
|
+
before_fork do
|
40
|
+
ActiveRecord::Base.connection_pool.disconnect!
|
41
|
+
end
|
42
|
+
|
37
43
|
on_worker_boot do
|
38
44
|
ActiveSupport.on_load(:active_record) do
|
39
45
|
ActiveRecord::Base.establish_connection
|
@@ -3,5 +3,5 @@
|
|
3
3
|
#
|
4
4
|
check process <%= puma_monit_service_name %>
|
5
5
|
with pidfile "<%= fetch(:puma_pid) %>"
|
6
|
-
start program = "/usr/bin/sudo -
|
7
|
-
stop program = "/usr/bin/sudo -
|
6
|
+
start program = "/usr/bin/sudo -iu <%= puma_user(@role) %> /bin/bash -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:puma] %> -C <%= fetch(:puma_conf) %> --daemon'"
|
7
|
+
stop program = "/usr/bin/sudo -iu <%= puma_user(@role) %> /bin/bash -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:pumactl] %> -S <%= fetch(:puma_state) %> stop'"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano3-puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: capistrano-bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: puma
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
41
55
|
description: Puma integration for Capistrano 3
|
42
56
|
email:
|
43
57
|
- Terminale@gmail.com
|
@@ -46,6 +60,8 @@ extensions: []
|
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
48
62
|
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
64
|
+
- CONTRIBUTORS.md
|
49
65
|
- Gemfile
|
50
66
|
- LICENSE.txt
|
51
67
|
- README.md
|
@@ -91,9 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
107
|
version: '0'
|
92
108
|
requirements: []
|
93
109
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.6.8
|
95
111
|
signing_key:
|
96
112
|
specification_version: 4
|
97
113
|
summary: Puma integration for Capistrano
|
98
114
|
test_files: []
|
99
|
-
has_rdoc:
|