seuros / capistrano-puma

Puma integration for Capistrano
https://github.com/seuros/capistrano-puma
MIT License
615 stars 299 forks source link

puma:restart service not found during deploy #352

Closed prodigerati closed 1 year ago

prodigerati commented 1 year ago

Is there a way to specify the service name for systemd?

I have an active service on the server

deploy@reports:~/apps/R7-reporting-2022/current$ sudo systemctl status R7-reporting-2022_puma_production.service [sudo] password for deploy: ● R7-reporting-2022_puma_production.service - Puma HTTP Server Loaded: loaded (/etc/systemd/system/R7-reporting-2022_puma_production.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2022-11-06 19:24:32 UTC; 1h 3min ago Main PID: 612 (puma) Tasks: 10 (limit: 4575) Memory: 177.7M CPU: 2.258s CGroup: /system.slice/R7-reporting-2022_puma_production.service └─612 "puma 6.0.0 (unix:///home/deploy/apps/R7-reporting-2022/shared/tmp/sockets/R7-reporting-2022-puma.sock)" "" "" "" "" "" ">

Nov 06 19:24:32 reports systemd[1]: Started Puma HTTP Server.

When I run bundle exec cap production deploy I get the following error

00:24 puma:restart 01 /bin/systemctl --user restart R7-reporting-2022_puma_production 01 Failed to restart R7-reporting-2022_puma_production.service: Unit R7-reporting-2022_puma_production.service not found.

any ideas on how to fix this issue?

Thanks!

prodigerati commented 1 year ago

After additional testing I was able to run the command directly on the server without the --user flag

/usr/bin/env /bin/systemctl restart R7-reporting-2022_puma_production

prodigerati commented 1 year ago

Switched to passenger, closing.

ankitsinghaniyaz commented 1 year ago

I'm seeing the same error!

djchadderton commented 1 year ago

For anyone else having this problem, it looks like :puma_systemctl_user has switched from defaulting to :system to :user. Adding set :puma_systemctl_user, :system to my deploy.rb file fixed it so it worked like the previous version.