capistrano3-puma 6.0.0 → 6.1.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 +4 -4
- data/CHANGELOG.md +10 -2
- data/LICENSE.txt +1 -1
- data/README.md +100 -5
- data/lib/capistrano/puma/systemd.rb +1 -0
- data/lib/capistrano/puma.rb +1 -0
- data/lib/capistrano/templates/puma.service.erb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d2f07d6e635bd2c3dd87706742d9f417140165102818a2f05f7be0b9d4e031d
|
4
|
+
data.tar.gz: ce613f7509c20d4520a599a0f93a9a6d5a0d485037c11aa94914fdca4c0fffcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c303ca5c2c0d1f28e288bffcb84ffe5ee69a708ad2c08bf000cc3f0004cdef369da1822b00b564d8c6c9e2ded34e54de7aa43a256e95384d6d7c29195a9538a1
|
7
|
+
data.tar.gz: 6750f2ae9a2c356cf1e099b5ea2e1144a6fc843bd5b9828e2843a50b15977df4e5cdc43b98216dff0bc02e40661d6934bb5a519e85734edb3a334e0a7e76a437
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
[
|
4
|
-
|
3
|
+
## [6.1.0](https://github.com/seuros/capistrano-puma/tree/6.1.0) (2025-01-21)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/seuros/capistrano-puma/compare/v6.0.0...6.1.0)
|
6
|
+
- Restored default value for `puma_bind` to fix socket activation (Issue #387)
|
7
|
+
- Added documentation for puma.rb symlink requirement in v6.0.0 (Issue #384)
|
8
|
+
- Made WatchdogSec configurable via `puma_systemd_watchdog_sec` (Issue #373)
|
9
|
+
- Improved documentation for first-time setup and troubleshooting (Issues #377, #376, #372)
|
10
|
+
- Added migration guide for upgrading from v5 to v6
|
11
|
+
- Added troubleshooting section for common issues
|
12
|
+
- Removed support for monit and upstart (will add them back if someone is willing to maintain them)
|
5
13
|
- Sync configuration with capistrano-sidekiq
|
6
14
|
- Support for notify systemd service. Add sd_notify gem to your Gemfile.
|
7
15
|
- Add example application for easier testing.
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -15,6 +15,34 @@ And then execute:
|
|
15
15
|
|
16
16
|
$ bundle
|
17
17
|
|
18
|
+
## Upgrading from Version 5.x to 6.x
|
19
|
+
|
20
|
+
Version 6.0 includes several breaking changes:
|
21
|
+
|
22
|
+
### Breaking Changes:
|
23
|
+
1. **Manual Puma Configuration**: The gem no longer generates `puma.rb` automatically
|
24
|
+
- You must create your own `config/puma.rb` in your repository
|
25
|
+
- Add it to `linked_files` in your `deploy.rb`
|
26
|
+
|
27
|
+
2. **Default puma_bind Removed**: You must explicitly set the bind address
|
28
|
+
```ruby
|
29
|
+
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"
|
30
|
+
```
|
31
|
+
|
32
|
+
3. **Systemd Service Changes**: Services are now user-specific by default
|
33
|
+
- Services are created in `~/.config/systemd/user/`
|
34
|
+
- Run `cap production puma:install` again after upgrading
|
35
|
+
|
36
|
+
### Migration Steps:
|
37
|
+
1. Create your `config/puma.rb` if you don't have one
|
38
|
+
2. Add to your `deploy.rb`:
|
39
|
+
```ruby
|
40
|
+
append :linked_files, 'config/puma.rb'
|
41
|
+
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"
|
42
|
+
```
|
43
|
+
3. Run `cap production puma:install` to update the systemd service
|
44
|
+
4. Deploy as normal
|
45
|
+
|
18
46
|
## Usage
|
19
47
|
```ruby
|
20
48
|
# Capfile
|
@@ -43,17 +71,53 @@ To make it work with rvm, rbenv and chruby, install the plugin after correspondi
|
|
43
71
|
### Config
|
44
72
|
|
45
73
|
Puma configuration is expected to be in `config/puma.rb` or `config/puma/#{fetch(:puma_env)}.rb` and checked in your repository.
|
46
|
-
Uploading the configuration via capistrano was removed as it was causing problems with custom configurations.
|
47
74
|
|
48
|
-
|
75
|
+
Starting with version 6.0.0, you need to manage the puma configuration file yourself. Here are the steps:
|
49
76
|
|
50
|
-
|
51
|
-
|
77
|
+
1. Create your puma configuration in `shared/config/puma.rb` on the server
|
78
|
+
2. Add it to linked_files in your `deploy.rb`:
|
79
|
+
```ruby
|
80
|
+
append :linked_files, 'config/puma.rb'
|
81
|
+
```
|
82
|
+
|
83
|
+
This ensures the puma configuration persists across deployments. The systemd service will start puma with `puma -e <environment>` from your app's current directory.
|
84
|
+
|
85
|
+
### First-Time Setup (IMPORTANT! 🎉)
|
86
|
+
|
87
|
+
**🙋 Hey there, human! Read this magical section and save yourself from confusion! 😊**
|
88
|
+
|
89
|
+
Before your first deployment, you MUST install the Puma systemd service on your server:
|
90
|
+
|
91
|
+
```bash
|
92
|
+
# ✨ This only needs to be done once per server/stage - it's like a first date! 💝
|
52
93
|
$ bundle exec cap production puma:install
|
53
94
|
```
|
54
95
|
|
55
|
-
|
96
|
+
This command will:
|
97
|
+
- 🏗️ Create the systemd service files for Puma
|
98
|
+
- 🚀 Enable the service to start on boot
|
99
|
+
- 🔐 Set up the proper user permissions
|
100
|
+
|
101
|
+
**🎭 Plot twist:** Without running this command first, your deployment will succeed but Puma won't start! (We know, it's sneaky like that 😅)
|
102
|
+
|
103
|
+
### Deployment
|
104
|
+
|
105
|
+
After the initial setup, normal deployments will work as expected:
|
106
|
+
```bash
|
107
|
+
$ bundle exec cap production deploy
|
108
|
+
```
|
109
|
+
|
110
|
+
The deployment process will automatically restart Puma using the installed systemd service.
|
111
|
+
|
112
|
+
To manually control the Puma service:
|
113
|
+
```bash
|
114
|
+
$ bundle exec cap production puma:start
|
115
|
+
$ bundle exec cap production puma:stop
|
116
|
+
$ bundle exec cap production puma:restart
|
56
117
|
```
|
118
|
+
|
119
|
+
To uninstall the systemd service:
|
120
|
+
```bash
|
57
121
|
$ bundle exec cap production puma:uninstall
|
58
122
|
```
|
59
123
|
|
@@ -100,6 +164,8 @@ Configurable options, shown here with defaults: Please note the configuration op
|
|
100
164
|
```ruby
|
101
165
|
set :puma_user, fetch(:user)
|
102
166
|
set :puma_role, :web
|
167
|
+
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"
|
168
|
+
set :puma_systemd_watchdog_sec, 10 # Set to 0 or false to disable watchdog
|
103
169
|
set :puma_service_unit_env_files, []
|
104
170
|
set :puma_service_unit_env_vars, []
|
105
171
|
```
|
@@ -109,6 +175,35 @@ __Notes:__ If you are setting values for variables that might be used by other p
|
|
109
175
|
append :rbenv_map_bins, 'puma', 'pumactl'
|
110
176
|
```
|
111
177
|
|
178
|
+
## Troubleshooting
|
179
|
+
|
180
|
+
### Puma is not starting after deployment
|
181
|
+
- Ensure you ran `cap production puma:install` before your first deployment
|
182
|
+
- Check the service status: `cap production puma:status`
|
183
|
+
- Check logs: `sudo journalctl -u your_app_puma_production -n 100`
|
184
|
+
|
185
|
+
### Nginx 502 Bad Gateway errors
|
186
|
+
This usually means nginx and puma have mismatched configurations:
|
187
|
+
- If nginx expects a unix socket but puma binds to a port (or vice versa)
|
188
|
+
- Ensure your `puma_bind` in deploy.rb matches your nginx upstream configuration
|
189
|
+
- Common configurations:
|
190
|
+
```ruby
|
191
|
+
# Unix socket (default)
|
192
|
+
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"
|
193
|
+
|
194
|
+
# TCP port
|
195
|
+
set :puma_bind, "tcp://0.0.0.0:3000"
|
196
|
+
```
|
197
|
+
|
198
|
+
### Puma keeps restarting (systemd watchdog kills it)
|
199
|
+
- Your app may take longer than 10 seconds to boot
|
200
|
+
- Disable or increase WatchdogSec (requires version 6.0.0+):
|
201
|
+
```ruby
|
202
|
+
set :puma_systemd_watchdog_sec, 30 # 30 seconds
|
203
|
+
# or
|
204
|
+
set :puma_systemd_watchdog_sec, 0 # Disable watchdog
|
205
|
+
```
|
206
|
+
|
112
207
|
# Nginx documentation
|
113
208
|
Nginx documentation was moved to [nginx.md](docs/nginx.md)
|
114
209
|
|
@@ -14,6 +14,7 @@ module Capistrano
|
|
14
14
|
set_if_empty :puma_systemctl_bin, -> { fetch(:systemctl_bin, '/bin/systemctl') }
|
15
15
|
set_if_empty :puma_service_unit_name, -> { "#{fetch(:application)}_puma_#{fetch(:stage)}" }
|
16
16
|
set_if_empty :puma_enable_socket_service, false
|
17
|
+
set_if_empty :puma_systemd_watchdog_sec, 10
|
17
18
|
|
18
19
|
set_if_empty :puma_service_unit_env_files, -> { fetch(:service_unit_env_files, []) }
|
19
20
|
set_if_empty :puma_service_unit_env_vars, -> { fetch(:service_unit_env_vars, []) }
|
data/lib/capistrano/puma.rb
CHANGED
@@ -110,6 +110,7 @@ module Capistrano
|
|
110
110
|
def set_defaults
|
111
111
|
set_if_empty :puma_role, :web
|
112
112
|
set_if_empty :puma_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
|
113
|
+
set_if_empty :puma_bind, -> { "unix://#{File.join(shared_path, 'tmp', 'sockets', 'puma.sock')}" }
|
113
114
|
set_if_empty :puma_access_log, -> { File.join(shared_path, 'log', "puma.log") }
|
114
115
|
set_if_empty :puma_error_log, -> { File.join(shared_path, 'log', "puma.log") }
|
115
116
|
|
@@ -16,7 +16,9 @@ After=syslog.target network.target
|
|
16
16
|
|
17
17
|
[Service]
|
18
18
|
Type=<%= service_unit_type %>
|
19
|
-
|
19
|
+
<% if fetch(:puma_systemd_watchdog_sec) && fetch(:puma_systemd_watchdog_sec) > 0 %>
|
20
|
+
WatchdogSec=<%= fetch(:puma_systemd_watchdog_sec) %>
|
21
|
+
<% end %>
|
20
22
|
<%="User=#{puma_user(@role)}" if fetch(:puma_systemctl_user) == :system %>
|
21
23
|
WorkingDirectory=<%= current_path %>
|
22
24
|
ExecStart=<%= expanded_bundle_command %> exec puma -e <%= fetch(:puma_env) %>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano3-puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: capistrano
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.6.
|
101
|
+
rubygems_version: 3.6.7
|
102
102
|
specification_version: 4
|
103
103
|
summary: Puma integration for Capistrano
|
104
104
|
test_files: []
|