Situation: I am using the Cloudflare Tunnel to load-balance a RESTful HTTP server running in Docker containers deployed across several geographically-distributed servers. This service requires 100% uptime across frequent updates.
Problem: I am using a rolling upgrade deployment pattern where new versions of a container are run parallel to old versions and new TCP connections are routed to the new container, leaving the old container to slowly starve until it can be killed. The key word here is “TCP connections.” For performance, Cloudflare Tunnel keeps reusing the same TCP connection, which is problematic because it means the old outdated container will never starve and can never be killed. Note that stopping the old tunnel abruptly is a no-go because that would terminate in-progress HTTP requests to my service.
Question 1: Is there a recommended/encouraged solution to achieve rolling updates with Cloudflare Tunnel running inside a Docker container?
If there is not a recommended/encouraged solution, then I have my own idea but am unsure how to achieve it, yielding Quesiton 2:
Question 2: If Question 1 is “no”, then how do I tell the Cloudflare Tunnel daemon to stop accepting new HTTP requests? And, how do I check/monitor for when the Cloudflare Tunnel daemon is completely drained out?
Many thanks, everyone. I wasn’t able to find any information in the Cloudflare docs about rolling upgrades, so any information/references you could provide would help me a lot.