Prevent removing old deployments

I'm working on a project that I plan to deploy to railway that would be really complicated for the end user if it was processing user information while a new instance is deployed and the old one is removed. What I was hoping for was to be able to do some sort of Blue-Green Deployment, where I can direct any new requests to the new deployment while the old one finishes up whatever it needs to, but it doesn't seem theirs a way to do this exactly. I did find RAILWAY_DEPLOYMENT_DRAINING_SECONDS that I think I should be able to configure to a very large amount but then can I somehow indicate to railway that it is ready to be removed? Or does it only do it after the RAILWAY_DEPLOYMENT_DRAINING_SECONDS time?

7 Replies

Prevent removing old deployments


a month ago

You can do exactly that with that variable you found. How it works is Railway will send your service a SIGTERM signal. It can then finalize its processes or do whatever. The seconds defined there is the upper cut off limit but your service can also simply exit once its done too.

This can also be configured in the UI if you so prefer:

image.png

Attachments


Ok cool, then I guess I'll just serve a "Upgrading" prompt, or somthing, to any new requests and refuse them, thanks!


a month ago

Don't worry, new requests will automatically be sent to the new deployment while the old one drains


Oh! That's exactly what I wanted then! 🔥


a month ago

Perfect


a month ago

<:smile_wink_point:1477393988234379575>


Welcome!

Sign in to your Railway account to join the conversation.

Loading...