Monday, October 5, 2015

Restarting unicorn


Every time you make any changes to your config files , you have to restart you server, at least that is what rails will notify you. It would be easy as pressing ctrl + c  if only you had run the rails server by doing rails s. But that is not the case if you are using servers such as nginx as your reverse proxy.

What you can do is, run service unicorn_appname restart in your app directory. If it works then that is fine. But if it does not and show you an error telling you to check your stderr file in the log directory, then follow on.
If you take a look at you stderr log file you will see something like this.
It is telling me that there is a process already running. So you have to kill that process and start your unicorn application server again.

Run ps aux | grep unicorn and it will list all the running processes. Since unicorn is running on 2710 i need to kill it.
pkill 2710 will kill the process and after that run service unicorn_fuitter start and now your app will be working just fine.

No comments:

Post a Comment