pgjones / hypercorn

Hypercorn is an ASGI and WSGI Server based on Hyper libraries and inspired by Gunicorn.
MIT License
1.12k stars 102 forks source link

Reload up to date SSL certificates without restarting server? #233

Open seidnerj opened 4 months ago

seidnerj commented 4 months ago

I think the title says it all. When we need to rotate certificates due to expiration, we have to do a rolling "restart" for the servers. We take each server out of the LB, restart it, add it back and proceed to the next server.

Is it possible to have hypercorn either reload certificates? e.g. once it notices a change in the filesystem and/or have it reload it by pinging an endpoint/running an executable or via specific code we could then initiate from a specialized endpoint.

I did find some potentially relevant discussions but looking through the code I did not find any way to currently achieve this:

  1. https://stackoverflow.com/questions/57812501/python-twisted-is-it-possible-to-reload-certificates-on-the-fly
  2. https://stackoverflow.com/questions/43860469/long-running-asyncio-server-reload-certificate