postrank-labs/goliath

How to stop Goliath server

larryzhao opened this issue · 6 comments

Hi,

I am trying to deploy our API project, I start Goliath with a nohup like this:

nohup bundle exec ruby server.rb --environment #{fetch(:goliath_env)} --log #{fetch(:log_file)} --pid #{fetch(:pid_file)} --socket #{fetch(:socket_file)} --daemonize &) && sleep 1

It's working pretty good, but how could I shut down a Goliath server safely. I try to do a kill -s QUIT xxxx on the pid, but it's not working.

dj2 commented

Doing kill xxxx should work fine for killing the server. What happens when you do it? Are you trying to kill as the user that the server is running as?

Thanks @dj2 kill xxxx does the job. So this is the safe and recommended way to stop a Goliath server right?

dj2 commented

Killing it that way will kill of any open connections which you many not want. We always ran our servers behind an HAProxy. Then, when we wanted to bring a new version up we'd bring up a set of servers on new ports, bring them online in HAProxy and have it stop serving the old ports. Once HA reported no more connections to the old servers we'd restart them.
shut them down.

@dj2 Thanks you very much for your response. I am now having my goliath servers behind nginx, does it mean I could replace nginx with haproxy and do what you described?

dj2 commented

You can probably do the same thing with Nginx, although I haven't done it.

You'd just have to setup the config so you have 2 groups of servers that it load balances between then when you want to upgrade, you take one side offline, upgrade and switch.

Thank you very much @dj2 . I am gonna give haproxy a try.