lucaslorentz / caddy-supervisor

Run and supervise background processes from Caddy
MIT License
33 stars 13 forks source link

Does caddy support "rainbow" deployments with graceful shutdown? #7

Closed madelson closed 4 years ago

madelson commented 5 years ago

I came across this repo when looking for a tool to help us manage ASP.NET Core app deployments both on local dev machines and on our production servers. I'm wondering if Caddy can help.

One of the behaviors we have today with legacy ASP.NET is a really clean method of rolling out new code and gracefully shutting down old code. For example when someone rebuilds the application locally or does a "hot deploy" in production, ASP.NET will gracefully spin down the old code, allowing it to spend as much time as it needs to finish requests and background work. At the same time it spins up the new code to handle incoming requests so that deployments are immediate and there is no downtime.

Does Caddy offer this kind of functionality?

lucaslorentz commented 4 years ago

Not with this plugin.

Currently, this plugin manages the process but doesn't check active connections in order to shut down the previous instance.

It sends an Interrupt signal to the running process, maybe you could use to start shutting down your .NET Core app, and configure a high TerminationGracePeriod so it has time to finish anything it is processing.

But in order to run 2 instances of the .NET Core application simultaneously and replace one instance by the other, this plugin still required some kind of dynamic/random port assignment and proxy, which we don't have right now.