部署后如何重新启动puma?

时间:2021-02-04 16:36:51

I'm using Rails, Puma, Capistrano3. I have installed the gem capistrano3-puma as well. I started Puma with Puma Jungle https://github.com/puma/puma/tree/master/tools/jungle/upstart

我正在使用Rails,Puma,Capistrano3。我也安装了宝石capistrano3-puma。我和Puma Jungle一起创办了Puma https://github.com/puma/puma/tree/master/tools/jungle/upstart

How do I restart Puma during deployment?

如何在部署期间重新启动Puma?

4 个解决方案

#1


31  

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路径。

#2


17  

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 11654 is 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(代码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并执行将被妖魔化。

#3


9  

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

希望能帮助别人

#4


2  

As far as I know, if you are using capistrano3-puma gem, you do not need to restart puma explicitly after deployment. There is a task add_default_hooks which does puma:smart_restart after deployment.

据我所知,如果你使用capistrano3-puma gem,你不需要在部署后明确重启puma。有一个任务add_default_hooks在部署后执行puma:smart_restart。

You can see the task list by cap -vT. I think cap puma:restart will do the work.

您可以通过cap -vT查看任务列表。我认为cap puma:restart会做的工作。

#1


31  

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路径。

#2


17  

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 11654 is 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(代码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并执行将被妖魔化。

#3


9  

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

希望能帮助别人

#4


2  

As far as I know, if you are using capistrano3-puma gem, you do not need to restart puma explicitly after deployment. There is a task add_default_hooks which does puma:smart_restart after deployment.

据我所知,如果你使用capistrano3-puma gem,你不需要在部署后明确重启puma。有一个任务add_default_hooks在部署后执行puma:smart_restart。

You can see the task list by cap -vT. I think cap puma:restart will do the work.

您可以通过cap -vT查看任务列表。我认为cap puma:restart会做的工作。