Ruby-on-rails 部署后如何重启puma?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29547314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to restart puma after deploy?
提问by mystdeim
I'm using Rails, Puma, Capistrano3. I have installed the gem capistrano3-pumaas well. I started Puma with Puma Jungle https://github.com/puma/puma/tree/master/tools/jungle/upstart
我正在使用 Rails、Puma、Capistrano3。我也安装了 gem capistrano3-puma。我用 Puma Jungle https://github.com/puma/puma/tree/master/tools/jungle/upstart开始了 Puma
How do I restart Puma during deployment?
如何在部署期间重新启动 Puma?
回答by JamesDullaghan
You can restart manually using the following command
您可以使用以下命令手动重启
bundle exec pumactl -P /home/deploy/.pids/puma.pid restart
Make sure you point to the correct pid path.
确保您指向正确的 pid 路径。
回答by René Michel
Production
生产
If you are using capistrano on production you can:
如果您在生产中使用 capistrano,您可以:
cap production deploy:restart
Development
发展
If you are on a development environment you can start to look for the pid
如果您在开发环境中,您可以开始寻找 pid
ps aux | grep puma
You will see something like this:
你会看到这样的事情:
user 11654 0.0 13.4 870204 137016 ? Sl Jul07 0:39 puma 2.13.4 (tcp://0.0.0.0:3000) [NameOfYourApp]
The number next to the username, in this case 11654is the process id (PID) of puma server. You can kill it manually and restart the server after. Run this command:
用户名旁边的数字,在本例中11654是 puma 服务器的进程 ID (PID)。您可以手动杀死它并在之后重新启动服务器。运行此命令:
kill -s 15 11654
This command is saying kill the process with id 11654 using signal SIGTERM (code 15). SIGTERM kills the process 'kindly' closing all files, connections, cleaning buffers, etc.
这个命令是说使用信号 SIGTERM (code 15) 杀死 ID 为 11654 的进程。SIGTERM 会“友好地”终止进程,关闭所有文件、连接、清理缓冲区等。
Last you run this command:
最后运行此命令:
puma -e development -p 3000 -d
Puma will be started again in development mode, listening on port 3000 and the execution will be demonized.
Puma 会在开发模式下再次启动,监听 3000 端口,执行会被妖魔化。
回答by Ray Hunter
I ran into the issue where I need to restart puma after some environment changes and did not want to do a full deploy of the application.
我遇到了在某些环境更改后需要重新启动 puma 并且不想对应用程序进行完整部署的问题。
I only wanted to restart puma and nginx. Here are the commands that worked for me:
我只想重启 puma 和 nginx。以下是对我有用的命令:
$ bundle exec cap production deploy:restart
$ bundle exec cap production puma:restart
Hope that helps someone
希望能帮助某人
回答by Sharvy Ahmed
As far as I know, if you are using capistrano3-pumagem, you do not need to restart puma explicitly after deployment. There is a task add_default_hookswhich does puma:smart_restartafter deployment.
据我所知,如果你使用capistrano3-pumagem,你不需要在部署后显式重启 puma。有一个任务add_default_hooks,其确实puma:smart_restart在部署后。
You can see the task list by cap -vT. I think cap puma:restartwill do the work.
您可以通过 来查看任务列表cap -vT。我认为cap puma:restart会做这项工作。

