Graceful server restart with Go

“Go has been designed as a backend language and is mostly used as such. Servers are the most common type of software produced with it. The question I’m going to answer here is: how to cleanly upgrade a running server?

image

Goals:

  • Do not close any of the existing connections: for instance, we don’t want to cut down any running deployment. However we want to be able to upgrade our services whenever we want without any constraint.
  • The socket should always be available for the users: if the socket is unavailable at any moment some user may get a ‘connection refused’ message which is not acceptable.
  • The new version of the process should be started and should replace the old one…”

http://blog.appsdeck.eu/post/105609534953/graceful-server-restart-with-go