docker-rollout icon indicating copy to clipboard operation
docker-rollout copied to clipboard

feat: true zero-downtime deployment with request draining

Open wowu opened this issue 1 year ago • 1 comments

Changes:

  • Add --pre-stop-hook argument.
  • Describe in README how to setup a true zero-downtime deployment.

Notes:

  • Hook name "pre-stop" (instead of "before-stop") is inspired by watchtower hooks. This way other hooks can be named "post-stop" etc
  • I decided not to add other hooks yet - we will add them when somebody reports a need with a valid use case
  • I think it's better to implement draining with an explicitly written command in a hook, rather than a flag like --drain with the same implementation, so users can actually understand the process

Close #21, #32.

wowu avatar Nov 03 '24 14:11 wowu

Thanks, @wowu. This looks fantastic! I'm looking forward to the rollout of this feature. 🚀

akoenig avatar Nov 18 '24 21:11 akoenig

What a great timing, I literally adopted this in my project solving exactly this issue, thinking it was a feature since the start, but I somehow missed it when I did the original implementation - but no, it was just merged 15min before me going to look for something like it.

Thank you both :)

jippi avatar May 29 '25 11:05 jippi

@jippi I'm really glad it's useful since day 1 😄

Can you tell me more about your use case? How are you running docker-rollout?

wowu avatar May 29 '25 13:05 wowu

@wowu I'm using it on MangaBaka which is an app built with SvelteKit.

I run 3 x web containers and 3 x API containers, and want them to roll out without dropping traffic.

They are fronted by nginx-proxy that handles everything else.

Implementation wise, I raw copy+pasted the config from the docs and adjusted the sleep to my settings - worked flawlessly and extensive load testing shows 0 dropped or failed requests.

jippi avatar May 29 '25 13:05 jippi

Cool! And how do you build and deploy and new container versions? I wonder how docker rollout fits in the process, is it used as a part of a deploy script or CI/CD pipeline?

wowu avatar May 29 '25 21:05 wowu

I deploy to a single host via GitLab CI runners :)

jippi avatar May 29 '25 21:05 jippi

Cool, thanks for sharing 😃

wowu avatar May 29 '25 21:05 wowu