capistrano3-puma 1.2.1 → 6.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +328 -0
- data/LICENSE.txt +1 -1
- data/README.md +44 -103
- data/lib/capistrano/puma/nginx.rb +22 -1
- data/lib/capistrano/puma/systemd.rb +63 -0
- data/lib/capistrano/puma.rb +123 -1
- data/lib/capistrano/tasks/nginx.rake +12 -2
- data/lib/capistrano/tasks/systemd.rake +139 -0
- data/lib/capistrano/templates/nginx_conf.erb +43 -28
- data/lib/capistrano/templates/puma.service.erb +40 -0
- data/lib/capistrano/templates/puma.socket.erb +22 -0
- data/lib/generators/capistrano/nginx_puma/config_generator.rb +0 -1
- metadata +39 -32
- data/.gitignore +0 -18
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/capistrano3-puma.gemspec +0 -23
- data/lib/capistrano/puma/jungle.rb +0 -2
- data/lib/capistrano/puma/monit.rb +0 -2
- data/lib/capistrano/puma/version.rb +0 -5
- data/lib/capistrano/puma/workers.rb +0 -2
- data/lib/capistrano/tasks/jungle.rake +0 -81
- data/lib/capistrano/tasks/monit.rake +0 -72
- data/lib/capistrano/tasks/puma.rake +0 -197
- data/lib/capistrano/tasks/workers.rake +0 -38
- data/lib/capistrano/templates/puma-deb.erb +0 -336
- data/lib/capistrano/templates/puma-rpm.erb +0 -328
- data/lib/capistrano/templates/puma.rb.erb +0 -42
- data/lib/capistrano/templates/puma_monit.conf.erb +0 -7
- data/lib/capistrano/templates/run-puma.erb +0 -9
data/lib/capistrano/puma.rb
CHANGED
@@ -1 +1,123 @@
|
|
1
|
-
|
1
|
+
require 'capistrano/bundler'
|
2
|
+
require 'capistrano/plugin'
|
3
|
+
|
4
|
+
module Capistrano
|
5
|
+
module PumaCommon
|
6
|
+
def puma_switch_user(role, &block)
|
7
|
+
user = puma_user(role)
|
8
|
+
if user == role.user
|
9
|
+
block.call
|
10
|
+
else
|
11
|
+
backend.as user do
|
12
|
+
block.call
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def puma_user(role)
|
18
|
+
properties = role.properties
|
19
|
+
properties.fetch(:puma_user) || # local property for puma only
|
20
|
+
fetch(:puma_user) ||
|
21
|
+
properties.fetch(:run_as) || # global property across multiple capistrano gems
|
22
|
+
role.user
|
23
|
+
end
|
24
|
+
|
25
|
+
def puma_bind
|
26
|
+
Array(fetch(:puma_bind)).collect do |bind|
|
27
|
+
"bind '#{bind}'"
|
28
|
+
end.join("\n")
|
29
|
+
end
|
30
|
+
|
31
|
+
def service_unit_type
|
32
|
+
## Jruby don't support notify
|
33
|
+
return "simple" if RUBY_ENGINE == "jruby"
|
34
|
+
fetch(:puma_service_unit_type,
|
35
|
+
## Check if sd_notify is available in the bundle
|
36
|
+
Gem::Specification.find_all_by_name("sd_notify").any? ? "notify" : "simple")
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
def compiled_template_puma(from, role)
|
41
|
+
@role = role
|
42
|
+
file = [
|
43
|
+
"lib/capistrano/templates/#{from}-#{role.hostname}-#{fetch(:stage)}.rb",
|
44
|
+
"lib/capistrano/templates/#{from}-#{role.hostname}.rb",
|
45
|
+
"lib/capistrano/templates/#{from}-#{fetch(:stage)}.rb",
|
46
|
+
"lib/capistrano/templates/#{from}.rb.erb",
|
47
|
+
"lib/capistrano/templates/#{from}.rb",
|
48
|
+
"lib/capistrano/templates/#{from}.erb",
|
49
|
+
"config/deploy/templates/#{from}.rb.erb",
|
50
|
+
"config/deploy/templates/#{from}.rb",
|
51
|
+
"config/deploy/templates/#{from}.erb",
|
52
|
+
File.expand_path("../templates/#{from}.erb", __FILE__),
|
53
|
+
File.expand_path("../templates/#{from}.rb.erb", __FILE__)
|
54
|
+
].detect { |path| File.file?(path) }
|
55
|
+
erb = File.read(file)
|
56
|
+
StringIO.new(ERB.new(erb, trim_mode: '-').result(binding))
|
57
|
+
end
|
58
|
+
|
59
|
+
def template_puma(from, to, role)
|
60
|
+
backend.upload! compiled_template_puma(from, role), to
|
61
|
+
end
|
62
|
+
|
63
|
+
PumaBind = Struct.new(:full_address, :kind, :address) do
|
64
|
+
def unix?
|
65
|
+
kind == :unix
|
66
|
+
end
|
67
|
+
|
68
|
+
def ssl?
|
69
|
+
kind == :ssl
|
70
|
+
end
|
71
|
+
|
72
|
+
def tcp
|
73
|
+
kind == :tcp || ssl?
|
74
|
+
end
|
75
|
+
|
76
|
+
def local
|
77
|
+
if unix?
|
78
|
+
self
|
79
|
+
else
|
80
|
+
PumaBind.new(
|
81
|
+
localize_address(full_address),
|
82
|
+
kind,
|
83
|
+
localize_address(address)
|
84
|
+
)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def localize_address(address)
|
91
|
+
address.gsub(/0\.0\.0\.0(.+)/, "127.0.0.1\\1")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def puma_binds
|
96
|
+
Array(fetch(:puma_bind)).map do |m|
|
97
|
+
etype, address = /(tcp|unix|ssl):\/{1,2}(.+)/.match(m).captures
|
98
|
+
PumaBind.new(m, etype.to_sym, address)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class Puma < Capistrano::Plugin
|
104
|
+
include PumaCommon
|
105
|
+
|
106
|
+
def set_defaults
|
107
|
+
set_if_empty :puma_role, :web
|
108
|
+
set_if_empty :puma_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
|
109
|
+
set_if_empty :puma_access_log, -> { File.join(shared_path, 'log', "puma.log") }
|
110
|
+
set_if_empty :puma_error_log, -> { File.join(shared_path, 'log', "puma.log") }
|
111
|
+
|
112
|
+
# Chruby, Rbenv and RVM integration
|
113
|
+
append :chruby_map_bins, 'puma', 'pumactl' if fetch(:chruby_map_bins)
|
114
|
+
append :rbenv_map_bins, 'puma', 'pumactl' if fetch(:rbenv_map_bins)
|
115
|
+
append :rvm_map_bins, 'puma', 'pumactl' if fetch(:rvm_map_bins)
|
116
|
+
|
117
|
+
# Bundler integration
|
118
|
+
append :bundle_bins, 'puma', 'pumactl'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
require 'capistrano/puma/systemd'
|
@@ -1,12 +1,22 @@
|
|
1
|
+
git_plugin = self
|
2
|
+
|
1
3
|
namespace :puma do
|
2
4
|
desc 'Setup nginx configuration'
|
3
5
|
task :nginx_config do
|
4
6
|
on roles(fetch(:puma_nginx, :web)) do |role|
|
5
|
-
puma_switch_user(role) do
|
6
|
-
template_puma('nginx_conf', "/tmp/nginx_#{fetch(:nginx_config_name)}", role)
|
7
|
+
git_plugin.puma_switch_user(role) do
|
8
|
+
git_plugin.template_puma('nginx_conf', "/tmp/nginx_#{fetch(:nginx_config_name)}", role)
|
7
9
|
sudo :mv, "/tmp/nginx_#{fetch(:nginx_config_name)} #{fetch(:nginx_sites_available_path)}/#{fetch(:nginx_config_name)}"
|
8
10
|
sudo :ln, '-fs', "#{fetch(:nginx_sites_available_path)}/#{fetch(:nginx_config_name)} #{fetch(:nginx_sites_enabled_path)}/#{fetch(:nginx_config_name)}"
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
14
|
+
|
15
|
+
desc 'Generate nginx configuration locally'
|
16
|
+
task :generate_nginx_config_locally do
|
17
|
+
fake_role = Struct.new(:hostname)
|
18
|
+
run_locally do
|
19
|
+
File.write('nginx.conf', git_plugin.compiled_template_puma("nginx_conf", fake_role.new("example.com")).string)
|
20
|
+
end
|
21
|
+
end
|
12
22
|
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
git_plugin = self
|
4
|
+
|
5
|
+
namespace :puma do
|
6
|
+
desc 'Install Puma systemd service'
|
7
|
+
task :install do
|
8
|
+
on roles(fetch(:puma_role)) do |role|
|
9
|
+
|
10
|
+
upload_compiled_template = lambda do |template_name, unit_filename|
|
11
|
+
git_plugin.template_puma template_name, "#{fetch(:tmp_dir)}/#{unit_filename}", role
|
12
|
+
systemd_path = fetch(:puma_systemd_conf_dir, git_plugin.fetch_systemd_unit_path)
|
13
|
+
if fetch(:puma_systemctl_user) == :system
|
14
|
+
sudo "mv #{fetch(:tmp_dir)}/#{unit_filename} #{systemd_path}"
|
15
|
+
else
|
16
|
+
execute :mkdir, "-p", systemd_path
|
17
|
+
execute :mv, "#{fetch(:tmp_dir)}/#{unit_filename}", "#{systemd_path}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
upload_compiled_template.call("puma.service", "#{fetch(:puma_service_unit_name)}.service")
|
22
|
+
|
23
|
+
if fetch(:puma_enable_socket_service)
|
24
|
+
upload_compiled_template.call("puma.socket", "#{fetch(:puma_service_unit_name)}.socket")
|
25
|
+
end
|
26
|
+
|
27
|
+
# Reload systemd
|
28
|
+
git_plugin.execute_systemd("daemon-reload")
|
29
|
+
invoke "puma:enable"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'Uninstall Puma systemd service'
|
34
|
+
task :uninstall do
|
35
|
+
invoke 'puma:disable'
|
36
|
+
on roles(fetch(:puma_role)) do |role|
|
37
|
+
systemd_path = fetch(:puma_systemd_conf_dir, git_plugin.fetch_systemd_unit_path)
|
38
|
+
if fetch(:puma_systemctl_user) == :system
|
39
|
+
sudo "rm -f #{systemd_path}/#{fetch(:puma_service_unit_name)}*"
|
40
|
+
else
|
41
|
+
execute :rm, "-f", "#{systemd_path}/#{fetch(:puma_service_unit_name)}*"
|
42
|
+
end
|
43
|
+
git_plugin.execute_systemd("daemon-reload")
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
desc 'Enable Puma systemd service'
|
49
|
+
task :enable do
|
50
|
+
on roles(fetch(:puma_role)) do
|
51
|
+
git_plugin.execute_systemd("enable", fetch(:puma_service_unit_name))
|
52
|
+
git_plugin.execute_systemd("enable", fetch(:puma_service_unit_name) + ".socket") if fetch(:puma_enable_socket_service)
|
53
|
+
|
54
|
+
if fetch(:puma_systemctl_user) != :system && fetch(:puma_enable_lingering)
|
55
|
+
execute :loginctl, "enable-linger", fetch(:puma_lingering_user)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc 'Disable Puma systemd service'
|
61
|
+
task :disable do
|
62
|
+
on roles(fetch(:puma_role)) do
|
63
|
+
git_plugin.execute_systemd("disable", fetch(:puma_service_unit_name))
|
64
|
+
git_plugin.execute_systemd("disable", fetch(:puma_service_unit_name) + ".socket") if fetch(:puma_enable_socket_service)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
desc 'Start Puma service via systemd'
|
69
|
+
task :start do
|
70
|
+
on roles(fetch(:puma_role)) do
|
71
|
+
git_plugin.execute_systemd("start", fetch(:puma_service_unit_name))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'Stop Puma service via systemd'
|
76
|
+
task :stop do
|
77
|
+
on roles(fetch(:puma_role)) do
|
78
|
+
git_plugin.execute_systemd("stop", fetch(:puma_service_unit_name))
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
desc 'Stop Puma socket via systemd'
|
83
|
+
task :stop_socket do
|
84
|
+
on roles(fetch(:puma_role)) do
|
85
|
+
git_plugin.execute_systemd("stop", fetch(:puma_service_unit_name) + ".socket")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
desc 'Restarts or reloads Puma service via systemd'
|
90
|
+
task :smart_restart do
|
91
|
+
if fetch(:puma_phased_restart)
|
92
|
+
invoke 'puma:reload'
|
93
|
+
else
|
94
|
+
invoke 'puma:restart'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
desc 'Restart Puma service via systemd'
|
99
|
+
task :restart do
|
100
|
+
on roles(fetch(:puma_role)) do
|
101
|
+
git_plugin.execute_systemd("restart", fetch(:puma_service_unit_name))
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
desc 'Restart Puma socket via systemd'
|
106
|
+
task :restart_socket do
|
107
|
+
on roles(fetch(:puma_role)) do
|
108
|
+
git_plugin.execute_systemd("restart", fetch(:puma_service_unit_name) + ".socket")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
desc 'Reload Puma service via systemd'
|
113
|
+
task :reload do
|
114
|
+
on roles(fetch(:puma_role)) do
|
115
|
+
service_ok = if fetch(:puma_systemctl_user) == :system
|
116
|
+
execute("#{fetch(:puma_systemctl_bin)} status #{fetch(:puma_service_unit_name)} > /dev/null", raise_on_non_zero_exit: false)
|
117
|
+
else
|
118
|
+
execute("#{fetch(:puma_systemctl_bin)} --user status #{fetch(:puma_service_unit_name)} > /dev/null", raise_on_non_zero_exit: false)
|
119
|
+
end
|
120
|
+
cmd = 'reload'
|
121
|
+
unless service_ok
|
122
|
+
cmd = 'restart'
|
123
|
+
end
|
124
|
+
if fetch(:puma_systemctl_user) == :system
|
125
|
+
sudo "#{fetch(:puma_systemctl_bin)} #{cmd} #{fetch(:puma_service_unit_name)}"
|
126
|
+
else
|
127
|
+
execute "#{fetch(:puma_systemctl_bin)}", "--user", cmd, fetch(:puma_service_unit_name)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
desc 'Get Puma service status via systemd'
|
133
|
+
task :status do
|
134
|
+
on roles(fetch(:puma_role)) do
|
135
|
+
git_plugin.execute_systemd("status", fetch(:puma_service_unit_name))
|
136
|
+
git_plugin.execute_systemd("status", fetch(:puma_service_unit_name) + ".socket") if fetch(:puma_enable_socket_service)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -1,32 +1,45 @@
|
|
1
1
|
upstream puma_<%= fetch(:nginx_config_name) %> { <%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
"server #{address.gsub(/0\.0\.0\.0(.+)/, "127.0.0.1\\1")} #{fetch(:nginx_http_flags)};"
|
2
|
+
@backends = puma_binds.map do |bind|
|
3
|
+
if bind.unix?
|
4
|
+
"server unix:#{bind.address} #{fetch(:nginx_socket_flags)};"
|
5
|
+
else
|
6
|
+
"server #{bind.local.address} #{fetch(:nginx_http_flags)};"
|
7
|
+
end
|
9
8
|
end
|
10
|
-
|
11
|
-
%><% @backends.each do |server| %>
|
9
|
+
%><% @backends.each do |server| %>
|
12
10
|
<%= server %><% end %>
|
13
11
|
}
|
14
|
-
<% if fetch(:nginx_use_ssl)
|
12
|
+
<% if fetch(:nginx_use_ssl) -%>
|
15
13
|
server {
|
16
14
|
listen 80;
|
17
|
-
|
15
|
+
server_name <%= fetch(:nginx_server_name) %>;
|
16
|
+
return 301 https://$host$1$request_uri;
|
18
17
|
}
|
19
|
-
<% end
|
18
|
+
<% end -%>
|
20
19
|
|
21
20
|
server {
|
22
|
-
<% if fetch(:nginx_use_ssl)
|
23
|
-
|
24
|
-
ssl
|
21
|
+
<% if fetch(:nginx_use_ssl) -%>
|
22
|
+
<% if fetch(:nginx_use_http2) -%>
|
23
|
+
listen 443 ssl http2;
|
24
|
+
<% else -%>
|
25
|
+
listen 443 ssl;
|
26
|
+
<% end -%>
|
27
|
+
<% if fetch(:nginx_ssl_certificate) -%>
|
28
|
+
ssl_certificate <%= fetch(:nginx_ssl_certificate) %>;
|
29
|
+
<% else -%>
|
25
30
|
ssl_certificate /etc/ssl/certs/<%= fetch(:nginx_config_name) %>.crt;
|
31
|
+
<% end -%>
|
32
|
+
<% if fetch(:nginx_ssl_certificate_key) -%>
|
33
|
+
ssl_certificate_key <%= fetch(:nginx_ssl_certificate_key) %>;
|
34
|
+
<% else -%>
|
26
35
|
ssl_certificate_key /etc/ssl/private/<%= fetch(:nginx_config_name) %>.key;
|
27
|
-
<%
|
36
|
+
<% end -%>
|
37
|
+
<% else -%>
|
28
38
|
listen 80;
|
29
|
-
<% end
|
39
|
+
<% end -%>
|
40
|
+
server_name <%= fetch(:nginx_server_name) %>;
|
41
|
+
root <%= current_path %>/public;
|
42
|
+
try_files $uri/index.html $uri @puma_<%= fetch(:nginx_config_name) %>;
|
30
43
|
|
31
44
|
client_max_body_size 4G;
|
32
45
|
keepalive_timeout 10;
|
@@ -34,17 +47,23 @@ server {
|
|
34
47
|
error_page 500 502 504 /500.html;
|
35
48
|
error_page 503 @503;
|
36
49
|
|
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
50
|
location @puma_<%= fetch(:nginx_config_name) %> {
|
51
|
+
proxy_http_version 1.1;
|
42
52
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
43
|
-
proxy_set_header
|
53
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
54
|
+
proxy_set_header Host $host;
|
44
55
|
proxy_redirect off;
|
45
|
-
|
56
|
+
proxy_set_header Upgrade $http_upgrade;
|
57
|
+
proxy_set_header Connection "Upgrade";
|
58
|
+
<% if fetch(:nginx_use_ssl) -%>
|
59
|
+
proxy_set_header X-Forwarded-Proto https;
|
60
|
+
<% else -%>
|
61
|
+
<% if fetch(:nginx_downstream_uses_ssl) -%>
|
46
62
|
proxy_set_header X-Forwarded-Proto https;
|
47
|
-
<%
|
63
|
+
<% else -%>
|
64
|
+
proxy_set_header X-Forwarded-Proto http;
|
65
|
+
<% end -%>
|
66
|
+
<% end -%>
|
48
67
|
proxy_pass http://puma_<%= fetch(:nginx_config_name) %>;
|
49
68
|
# limit_req zone=one;
|
50
69
|
access_log <%= shared_path %>/log/nginx.access.log;
|
@@ -80,8 +99,4 @@ server {
|
|
80
99
|
if (-f $document_root/system/maintenance.html) {
|
81
100
|
return 503;
|
82
101
|
}
|
83
|
-
|
84
|
-
location ~ \.(php|html)$ {
|
85
|
-
return 405;
|
86
|
-
}
|
87
102
|
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# This file tells systemd how to run Puma as a 24/7 long-running daemon.
|
2
|
+
#
|
3
|
+
# Customize this file based on your bundler location, app directory, etc.
|
4
|
+
# Customize and copy this into /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
|
5
|
+
# Then run:
|
6
|
+
# - systemctl enable <%= fetch(:puma_service_unit_name) %>
|
7
|
+
# - systemctl {start,stop,restart} <%= fetch(:puma_service_unit_name) %>
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# Use `journalctl -u <%= fetch(:puma_service_unit_name) %> -rn 100` to view the last 100 lines of log output.
|
11
|
+
#
|
12
|
+
[Unit]
|
13
|
+
Description=Puma HTTP Server for <%= "#{fetch(:application)} (#{fetch(:stage)})" %>
|
14
|
+
<%= "Requires=#{fetch(:puma_service_unit_name)}.socket" if fetch(:puma_enable_socket_service) %>
|
15
|
+
After=syslog.target network.target
|
16
|
+
|
17
|
+
[Service]
|
18
|
+
Type=<%= service_unit_type %>
|
19
|
+
WatchdogSec=10
|
20
|
+
<%="User=#{puma_user(@role)}" if fetch(:puma_systemctl_user) == :system %>
|
21
|
+
WorkingDirectory=<%= current_path %>
|
22
|
+
ExecStart=<%= expanded_bundle_command %> exec puma -e <%= fetch(:puma_env) %>
|
23
|
+
ExecReload=/bin/kill -USR1 $MAINPID
|
24
|
+
<%- Array(fetch(:puma_service_unit_env_files)).each do |file| %>
|
25
|
+
<%="EnvironmentFile=#{file}" -%>
|
26
|
+
<% end -%>
|
27
|
+
<% Array(fetch(:puma_service_unit_env_vars)).each do |environment_variable| %>
|
28
|
+
<%="Environment=\"#{environment_variable}\"" -%>
|
29
|
+
<% end -%>
|
30
|
+
|
31
|
+
# if we crash, restart
|
32
|
+
RestartSec=1
|
33
|
+
Restart=on-failure
|
34
|
+
|
35
|
+
<%="StandardOutput=append:#{fetch(:puma_access_log)}" if fetch(:puma_access_log) %>
|
36
|
+
<%="StandardError=append:#{fetch(:puma_error_log)}" if fetch(:puma_error_log) %>
|
37
|
+
|
38
|
+
SyslogIdentifier=<%= fetch(:puma_service_unit_name) %>
|
39
|
+
[Install]
|
40
|
+
WantedBy=<%=(fetch(:puma_systemctl_user) == :system) ? "multi-user.target" : "default.target"%>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=Puma HTTP Server Accept Sockets for <%= "#{fetch(:application)} (#{fetch(:stage)})" %>
|
3
|
+
|
4
|
+
[Socket]
|
5
|
+
<% puma_binds.each do |bind| -%>
|
6
|
+
<%= "ListenStream=#{bind.local.address}" %>
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
# Don't let systemd accept the request, wait for Puma to do that.
|
10
|
+
# Systemd will start the puma service upon first request if it wasn't started.
|
11
|
+
#
|
12
|
+
# You might also want to set your Nginx upstream to have a fail_timeout large enough to accomodate your app's
|
13
|
+
# startup time.
|
14
|
+
Accept=no
|
15
|
+
<%= "NoDelay=true" if fetch(:puma_systemctl_user) == :system %>
|
16
|
+
ReusePort=true
|
17
|
+
Backlog=1024
|
18
|
+
|
19
|
+
SyslogIdentifier=puma_socket
|
20
|
+
|
21
|
+
[Install]
|
22
|
+
WantedBy=sockets.target
|
@@ -9,7 +9,6 @@ module Capistrano
|
|
9
9
|
:banner => "path to templates"
|
10
10
|
|
11
11
|
def copy_template
|
12
|
-
copy_file "../../../../capistrano/templates/puma.rb.erb", "#{templates_path}/puma.rb.erb"
|
13
12
|
copy_file "../../../../capistrano/templates/nginx_conf.erb", "#{templates_path}/nginx_conf.erb"
|
14
13
|
# copy_file "puma.rb.erb", "#{templates_path}/puma.rb.erb"
|
15
14
|
# copy_file "puma_init.erb", "#{templates_path}/puma_init.erb"
|
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: 6.0.0.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,28 +16,48 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.7'
|
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.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: capistrano-bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: puma
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '5.1'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '7.0'
|
34
51
|
type: :runtime
|
35
52
|
prerelease: false
|
36
53
|
version_requirements: !ruby/object:Gem::Requirement
|
37
54
|
requirements:
|
38
55
|
- - ">="
|
39
56
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
57
|
+
version: '5.1'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '7.0'
|
41
61
|
description: Puma integration for Capistrano 3
|
42
62
|
email:
|
43
63
|
- Terminale@gmail.com
|
@@ -45,29 +65,17 @@ executables: []
|
|
45
65
|
extensions: []
|
46
66
|
extra_rdoc_files: []
|
47
67
|
files:
|
48
|
-
-
|
49
|
-
- Gemfile
|
68
|
+
- CHANGELOG.md
|
50
69
|
- LICENSE.txt
|
51
70
|
- README.md
|
52
|
-
- Rakefile
|
53
|
-
- capistrano3-puma.gemspec
|
54
71
|
- lib/capistrano/puma.rb
|
55
|
-
- lib/capistrano/puma/jungle.rb
|
56
|
-
- lib/capistrano/puma/monit.rb
|
57
72
|
- lib/capistrano/puma/nginx.rb
|
58
|
-
- lib/capistrano/puma/
|
59
|
-
- lib/capistrano/puma/workers.rb
|
60
|
-
- lib/capistrano/tasks/jungle.rake
|
61
|
-
- lib/capistrano/tasks/monit.rake
|
73
|
+
- lib/capistrano/puma/systemd.rb
|
62
74
|
- lib/capistrano/tasks/nginx.rake
|
63
|
-
- lib/capistrano/tasks/
|
64
|
-
- lib/capistrano/tasks/workers.rake
|
75
|
+
- lib/capistrano/tasks/systemd.rake
|
65
76
|
- lib/capistrano/templates/nginx_conf.erb
|
66
|
-
- lib/capistrano/templates/puma
|
67
|
-
- lib/capistrano/templates/puma
|
68
|
-
- lib/capistrano/templates/puma.rb.erb
|
69
|
-
- lib/capistrano/templates/puma_monit.conf.erb
|
70
|
-
- lib/capistrano/templates/run-puma.erb
|
77
|
+
- lib/capistrano/templates/puma.service.erb
|
78
|
+
- lib/capistrano/templates/puma.socket.erb
|
71
79
|
- lib/capistrano3-puma.rb
|
72
80
|
- lib/generators/capistrano/nginx_puma/USAGE
|
73
81
|
- lib/generators/capistrano/nginx_puma/config_generator.rb
|
@@ -75,7 +83,8 @@ homepage: https://github.com/seuros/capistrano-puma
|
|
75
83
|
licenses:
|
76
84
|
- MIT
|
77
85
|
metadata: {}
|
78
|
-
post_install_message:
|
86
|
+
post_install_message: "\n Version 6.0.0 is a major release. Please see README.md,
|
87
|
+
breaking changes are listed in CHANGELOG.md\n "
|
79
88
|
rdoc_options: []
|
80
89
|
require_paths:
|
81
90
|
- lib
|
@@ -83,17 +92,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
92
|
requirements:
|
84
93
|
- - ">="
|
85
94
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
95
|
+
version: '2.5'
|
87
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
97
|
requirements:
|
89
|
-
- - "
|
98
|
+
- - ">"
|
90
99
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
100
|
+
version: 1.3.1
|
92
101
|
requirements: []
|
93
|
-
|
94
|
-
|
95
|
-
signing_key:
|
102
|
+
rubygems_version: 3.2.33
|
103
|
+
signing_key:
|
96
104
|
specification_version: 4
|
97
105
|
summary: Puma integration for Capistrano
|
98
106
|
test_files: []
|
99
|
-
has_rdoc:
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
data/capistrano3-puma.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'capistrano/puma/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'capistrano3-puma'
|
8
|
-
spec.version = Capistrano::Puma::VERSION
|
9
|
-
spec.authors = ['Abdelkader Boudih']
|
10
|
-
spec.email = ['Terminale@gmail.com']
|
11
|
-
spec.description = %q{Puma integration for Capistrano 3}
|
12
|
-
spec.summary = %q{Puma integration for Capistrano}
|
13
|
-
spec.homepage = 'https://github.com/seuros/capistrano-puma'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
spec.required_ruby_version = '>= 1.9.3'
|
17
|
-
|
18
|
-
spec.files = `git ls-files`.split($/)
|
19
|
-
spec.require_paths = ['lib']
|
20
|
-
|
21
|
-
spec.add_dependency 'capistrano', '~> 3.0'
|
22
|
-
spec.add_dependency 'puma' , '>= 2.6'
|
23
|
-
end
|