Is there a way to keep old containers running?
ignisda
HOBBYOP

a year ago

So I have a usecase which I am not sure how to solve:

Users can perform imports on my application which last 5-6 hours and are non-resumable. I want a way to keep old containers running until an import is running even when I deploy a new version. Is this possible?

28 Replies

ignisda
HOBBYOP

a year ago

N/A


a year ago

You can extend how long previous containers keep running, but you can't keep them running indefinitely


ignisda
HOBBYOP

a year ago

how would I go about extending them?


ignisda
HOBBYOP

a year ago

I want all old containers to keep running for 12 hrs but dont want requests to be routed to them


a year ago

you can set a service variable RAILWAY_DEPLOYMENT_OVERLAP_SECONDS to the amount of additional seconds you want the deployment to be running

I can't remember what the max amount is though, I think it was a few hours


ignisda
HOBBYOP

a year ago

the docs on this env variable are lacking. what does overlap here mean?

1290351418670059500


a year ago

It's how long Railway will keep the previous deployment running when you make a new deployment


a year ago

typically when you create a new deployment, Railway keeps the previous one running for about 20 seconds just to ensure the new one takes over seamlessly


ignisda
HOBBYOP

a year ago

will requests be routed to this old container?


ignisda
HOBBYOP

a year ago

its not working btw

1290352305845309400


a year ago

I'm not sure, if you want to be sure then you could use RAILWAY_DEPLOYMENT_DRAINING_SECONDS instead

what this does is Railway will send your container a SIGTERM first, your app can then take that and start finishing jobs and not accept new ones

then once your app finishes all active jobs it can exit by itself (the amount of seconds you specify in this case is how long until Railway forces your app to close with SIGKILL)


a year ago

in what way is it not working? Does the previous container get removed regardless?


ignisda
HOBBYOP

a year ago

yes it does


a year ago

can you try redeploying again


ignisda
HOBBYOP

a year ago

unfortunately the background job itself is written in a way that it is not resumable. so this is not very helful for me


ignisda
HOBBYOP

a year ago

i did


ignisda
HOBBYOP

a year ago

project id: 6ef7539d-c186-4609-a904-178fd8fa7fa0


a year ago

it wouldn't have to resume because you would never have to pause it


a year ago

Strange, perhaps it's above the max amount? I completely forgot what the max amount is 😔


ignisda
HOBBYOP

a year ago

its not mentioned on the docs as well


ignisda
HOBBYOP

a year ago

i set it to 3600, still does not work


a year ago

you want draining not overlap


a year ago

this then


ignisda
HOBBYOP

a year ago

yep that seems to be working


ignisda
HOBBYOP

a year ago

is there a max value to this?


ignisda
HOBBYOP

a year ago

can i set it to 20k?


a year ago

5.5hr should be fine


ignisda
HOBBYOP

a year ago

alright thanks


Loading...