Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restart puma after deploy?

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

How do I restart Puma during deployment?

like image 839
mystdeim Avatar asked Apr 09 '15 19:04

mystdeim


3 Answers

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.

like image 175
JamesDullaghan Avatar answered Oct 02 '22 10:10

JamesDullaghan


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.

like image 41
René Michel Avatar answered Oct 02 '22 10:10

René Michel


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

like image 34
Ray Hunter Avatar answered Oct 02 '22 11:10

Ray Hunter