How to restart puma after deploy?

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.


Production

If you are using capistrano on production you can:

cap production deploy:restart

Development

If you are on a development environment you can start to look for the 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:

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.

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.


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.

I only wanted to restart puma and nginx. Here are the commands that worked for me:

$ bundle exec cap production deploy:restart
$ bundle exec cap production puma:restart

Hope that helps someone


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.

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