capistrano-puma: puma:restart related to deploy doesn't work
capistrano (3.8.2) capistrano3-puma (3.1.0) capistrano-rbenv (2.1.1) capistrano-bundler (1.2.0) puma (3.9.1)
In config/deploy.rb:
set :rbenv_map_bins, %w(rake gem bundle ruby rails puma pumactl sidekiq sidekiqctl)
When I deploy, puma:restart says it went ok:
02:20 puma:restart
01 $HOME/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/user/app/shared/tmp/pids/puma.state -F /home/user/app/shared/config/puma.rb restart
01 Command restart sent success
✔ 01 user@server 0.780s
but the app didn’t restart, and in the log there is this error:
==> log/puma_error.log <==
/home/user/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem puma (>= 0.a) (Gem::GemNotFoundException)
from /home/user/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems.rb:298:in `activate_bin_path'
from /home/user/app/shared/bundle/ruby/2.4.0/bin/puma:22:in `<main>'
Instead, if I restart manually running cap puma:restart after the deploy it works:
> cap stage puma:restart
00:00 puma:start
using conf file /home/user/app/shared/config/puma.rb
01 $HOME/.rbenv/bin/rbenv exec bundle exec puma -C /home/user/app/shared/config/puma.rb --daemon
01 Puma starting in single mode...
01
01 * Version 3.9.1 (ruby 2.4.1-p111), codename: Private Caller
01
01 * Min threads: 0, max threads: 16
01
01 * Environment: staging
01
01 * Daemonizing...
01
✔ 01 user@server 0.800s
Maybe something related to rbenv?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 27
- Comments: 51 (3 by maintainers)
Commits related to this issue
- trying to fix issue with capistrano when restarting puma -- fix comes from here: https://github.com/seuros/capistrano-puma/issues/237 — committed to carlosgarciagit/BlockParty by eliotpiering 7 years ago
- Downgrade to Puma 3.8.1 The current version of Puma seems to have problems with restarting, downgrade to 3.8.1 should fix this. See also: https://github.com/seuros/capistrano-puma/issues/237 and http... — committed to OpenlyOne/openly-rails by FinnWoelm 7 years ago
- Merge branch 'hotfix-0.1.1' Hotfix 0.1.1 Fixes a problem where the `puma:restart` task issued at the end of `cap production deploy` would cause puma to crash (rather than restart). This [issue is kn... — committed to OpenlyOne/openly-rails by FinnWoelm 7 years ago
- Merge branch 'hotfix-0.1.1' into development Hotfix 0.1.1 Fixes a problem where the `puma:restart` task issued at the end of `cap production deploy` would cause puma to crash (rather than restart). ... — committed to OpenlyOne/openly-rails by FinnWoelm 7 years ago
- Gem: Upgrade puma (v3.11.3) According to https://github.com/seuros/capistrano-puma/issues/237, the issue around capistrano-puma has been fixed in > v3.10 — committed to OpenlyOne/openly-rails by FinnWoelm 6 years ago
Nice info. puma 3.10.0 works for me too!
Hi,
puma 3.10.0 works for me!
Same issue with puma 4.3.3, with capistrano3-puma 4.0.0
After deploy restart is sent, but puma is not started.
A simple solution is adding
puma:startafter deploy finishedAnother workaround:
gem 'puma', '3.8.1'Hey!
I have the exact same issue with puma 4. Do you have any solution?
This answer is the only “solution” I found: https://stackoverflow.com/a/44796030
But it feels wrong.
Thank you for you work!
If I’m correct, this is way different from
puma:restart, because it will not perform a hot restart and you may lose requests during the deploy. I do not advise to do that, please correct me if I’m wrongRef: https://github.com/puma/puma/blob/master/docs/restart.md#normal-vs-hot-vs-phased-restart
I have a “standard” deploy script I use in all my projects, and I have added the following line to it:
workaround has been working fine for a couple of years now.
On Thu, 14 May 2020 at 10:13, Guillaume Briday notifications@github.com wrote:
@prashantvithani Looks like 3.8.2 has the same issue (at least I didn’t notice any changes with 3.9.*), try downgrading it to 3.8.1. Worked for me
I ran into the problem that Capistrano Puma basic tasks were not showing up (restart, stop, start). This happens because, in Capistrano Puma 5.0, the tasks were moved to the service manager modules,
After
be sure to add:
or if you use Systemd
then all tasks should show up now and Puma should restart after deployment.
Note that Capistrano::Puma::Daemon is incompatible with Puma 5+ as daemonization support was removed. Use systemd instead (puma systemd)
Source: https://github.com/seuros/capistrano-puma/issues/310
@jmuheim it’s likely not a problem on this gem (tho I appreciate that @seuros left this issue open, as it helps getting to know that this bug still happens); it’s likely to be an issue on certain versions of Puma, maybe combined with certain versions of Bundler and / or certain versions of Rails 😕
@vast I had the same problem, I use Rails 6. I solved when I did override the task. In my
config/deploy.rbI added the bellow code.I used this link as a reference https://stackoverflow.com/questions/44763777/capistrano-pumarestart-not-working-but-pumastart-does I hope that helps you