capistrano3-puma 6.1.0 → 6.2.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
2
  SHA256:
3
- metadata.gz: 9d2f07d6e635bd2c3dd87706742d9f417140165102818a2f05f7be0b9d4e031d
4
- data.tar.gz: ce613f7509c20d4520a599a0f93a9a6d5a0d485037c11aa94914fdca4c0fffcd
3
+ metadata.gz: a0e3b56cceac3a829240f070437a0e232c5c79f38370989572024ab08af9038a
4
+ data.tar.gz: 67e21b9c665facae205f009b694d6a2652c0a9546c95a3db3739fac5c5a0159f
5
5
  SHA512:
6
- metadata.gz: c303ca5c2c0d1f28e288bffcb84ffe5ee69a708ad2c08bf000cc3f0004cdef369da1822b00b564d8c6c9e2ded34e54de7aa43a256e95384d6d7c29195a9538a1
7
- data.tar.gz: 6750f2ae9a2c356cf1e099b5ea2e1144a6fc843bd5b9828e2843a50b15977df4e5cdc43b98216dff0bc02e40661d6934bb5a519e85734edb3a334e0a7e76a437
6
+ metadata.gz: 3c216aed4f83378c3ecf0a2bb0cab5c7046eb1a2ad9bf280691ea4325e6d583dbf98640c14e7c8e793eb8ee9c3645d2c0da17b9205e20db3c48b330fa4ed80ed
7
+ data.tar.gz: 4b19a5a3c2513402c5987ec0e501e5dcb19d7fb47e80b3ad4eec037d1a4171c1ba9645c0bad51f8cc28f5c8f16f215084015f1e32861784fd13ccbe364a995a1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.2.0](https://github.com/seuros/capistrano-puma/tree/6.2.0) (2025-06-22)
4
+
5
+ [Full Changelog](https://github.com/seuros/capistrano-puma/compare/v6.1.0...6.2.0)
6
+ - Harmonized interface with capistrano-sidekiq for better ecosystem consistency
7
+ - Aligned configuration variable naming patterns
8
+ - Unified systemd command execution methods
9
+ - Standardized template search order across both gems
10
+ - Added documentation reference to example application
11
+
3
12
  ## [6.1.0](https://github.com/seuros/capistrano-puma/tree/6.1.0) (2025-01-21)
4
13
 
5
14
  [Full Changelog](https://github.com/seuros/capistrano-puma/compare/v6.0.0...6.1.0)
data/README.md CHANGED
@@ -1,6 +1,17 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/capistrano3-puma.svg)](http://badge.fury.io/rb/capistrano3-puma)
2
2
  # Capistrano::Puma
3
3
 
4
+ Puma integration for Capistrano - providing systemd service management and zero-downtime deployments for Puma 5.1+.
5
+
6
+ ## Example Application
7
+
8
+ For a complete working example of this gem in action, see the [capistrano-example-app](https://github.com/seuros/capistrano-example-app) which demonstrates:
9
+ - Rails 8.0 deployment with Capistrano
10
+ - Puma 6.0 with systemd socket activation
11
+ - Zero-downtime deployments
12
+ - rbenv integration
13
+ - Nginx configuration examples
14
+
4
15
  ## Installation
5
16
 
6
17
  Add this line to your application's Gemfile:
@@ -26,10 +26,6 @@ module Capistrano
26
26
  set_if_empty :puma_service_templates_path, fetch(:service_templates_path, 'config/deploy/templates')
27
27
  end
28
28
 
29
- def expanded_bundle_command
30
- backend.capture(:echo, SSHKit.config.command_map[:bundle]).strip
31
- end
32
-
33
29
  def fetch_systemd_unit_path
34
30
  if fetch(:puma_systemctl_user) == :system
35
31
  "/etc/systemd/system/"
@@ -6,18 +6,18 @@ module Capistrano
6
6
  def puma_switch_user(role, &block)
7
7
  user = puma_user(role)
8
8
  if user == role.user
9
- block.call
9
+ yield
10
10
  else
11
- backend.as user do
12
- block.call
13
- end
11
+ backend.as(user, &block)
14
12
  end
15
13
  end
16
14
 
17
15
  def puma_user(role)
18
16
  properties = role.properties
17
+ return role.user unless properties
18
+
19
19
  properties.fetch(:puma_user) || # local property for puma only
20
- fetch(:puma_user) ||
20
+ fetch(:puma_user, nil) ||
21
21
  properties.fetch(:run_as) || # global property across multiple capistrano gems
22
22
  role.user
23
23
  end
@@ -53,11 +53,7 @@ module Capistrano
53
53
  File.expand_path("../templates/#{from}.rb.erb", __FILE__)
54
54
  ].detect { |path| File.file?(path) }
55
55
  erb = File.read(file)
56
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.6')
57
- StringIO.new(ERB.new(erb, nil, '-').result(binding))
58
- else
59
- StringIO.new(ERB.new(erb, trim_mode: '-').result(binding))
60
- end
56
+ StringIO.new(ERB.new(erb, trim_mode: '-').result(binding))
61
57
  end
62
58
 
63
59
  def template_puma(from, to, role)
@@ -102,6 +98,10 @@ module Capistrano
102
98
  PumaBind.new(m, etype.to_sym, address)
103
99
  end
104
100
  end
101
+
102
+ def expanded_bundle_command
103
+ backend.capture(:echo, SSHKit.config.command_map[:bundle]).strip
104
+ end
105
105
  end
106
106
 
107
107
  class Puma < Capistrano::Plugin
@@ -109,10 +109,10 @@ module Capistrano
109
109
 
110
110
  def set_defaults
111
111
  set_if_empty :puma_role, :web
112
- set_if_empty :puma_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
112
+ set_if_empty :puma_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:rake_env, fetch(:stage)))) }
113
113
  set_if_empty :puma_bind, -> { "unix://#{File.join(shared_path, 'tmp', 'sockets', 'puma.sock')}" }
114
114
  set_if_empty :puma_access_log, -> { File.join(shared_path, 'log', "puma.log") }
115
- set_if_empty :puma_error_log, -> { File.join(shared_path, 'log', "puma.log") }
115
+ set_if_empty :puma_error_log, -> { File.join(shared_path, 'log', "puma_error.log") }
116
116
 
117
117
  # Chruby, Rbenv and RVM integration
118
118
  append :chruby_map_bins, 'puma', 'pumactl' if fetch(:chruby_map_bins)
@@ -21,7 +21,11 @@ WatchdogSec=<%= fetch(:puma_systemd_watchdog_sec) %>
21
21
  <% end %>
22
22
  <%="User=#{puma_user(@role)}" if fetch(:puma_systemctl_user) == :system %>
23
23
  WorkingDirectory=<%= current_path %>
24
+ <% if fetch(:puma_use_login_shell) %>
25
+ ExecStart=/bin/bash -lc '<%= expanded_bundle_command %> exec puma -e <%= fetch(:puma_env) %>'
26
+ <% else %>
24
27
  ExecStart=<%= expanded_bundle_command %> exec puma -e <%= fetch(:puma_env) %>
28
+ <% end %>
25
29
  ExecReload=/bin/kill -USR1 $MAINPID
26
30
  <%- Array(fetch(:puma_service_unit_env_files)).each do |file| %>
27
31
  <%="EnvironmentFile=#{file}" -%>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano3-puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih