You will need to stop and restart the listener, which in itself will be a "downtime".
If this is necessary for βno downtime,β one option is to build a graceful restart by deploying a child instance:
http://grisha.org/blog/2014/06/03/graceful-restart-in-golang/
But in fact, this is a false sense of security ... The fact that you have only one instance running and trying to ensure that this instance is stable means that this is the only point of failure, since you cannot guarantee uptime. Server reboot, application panic, connection drop.
Instead, consider setting up a web farm for at least 2 or 3 nodes to distribute traffic.
Listen to me for a moment ...
Amazon AWS has an "elastic bean stock" (among other similar offers). Windows Azure has Websites. Both of these managed options allow you to perform updates for Rolling Updates. Release SSH access and just lean back and let it control.
What are rolling updates? Say you have two instances in version 1. You want to deploy version 2.
- You upgrade the package and AWS launches the deployment by starting the third instance.
- Once the virtual machine is in a βreadyβ state, when you deploy and run your version 2 code, AWS will start sending TCP traffic to it by changing the ELB (load balancer).
- AWS will stop sending traffic to one of the old nodes of version 1. It does not close it yet, it just stops sending new connections.
- After all TCP connections to this instance of the old version 1 have been deleted, AWS then disconnects this instance.
- AWS now includes the 4th instance of version 2, and in a ready state begins to control traffic.
- AWS stops traffic until the last instance of old version 1, waiting for the completion of existing connections.
- After disconnecting, AWS disconnects the latest instance of the old version.
Zero downtime. Zero connections have fallen. Fixed Zero TCP packages. Fully automated. Rolling updates to your SSL certificates as you want.
This, of course, is fully customizable, for example, Blue / Green deployment (first it launches several new instances and directs all new traffic to a new environment - it is best suited for changing the database schema). You can also test canaries with little traffic, etc.
source share