R
Railwayβ€’2mo ago
IgnisDa

Is there a way to keep old containers running?

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?
Solution:
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)...
Jump to solution
21 Replies
Percy
Percyβ€’2mo ago
Project ID: N/A
IgnisDa
IgnisDaOPβ€’2mo ago
N/A
Fragly
Fraglyβ€’2mo ago
You can extend how long previous containers keep running, but you can't keep them running indefinitely
IgnisDa
IgnisDaOPβ€’2mo ago
how would I go about extending them? I want all old containers to keep running for 12 hrs but dont want requests to be routed to them
Fragly
Fraglyβ€’2mo 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
IgnisDaOPβ€’2mo ago
the docs on this env variable are lacking. what does overlap here mean?
No description
Fragly
Fraglyβ€’2mo ago
It's how long Railway will keep the previous deployment running when you make a new deployment 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
IgnisDaOPβ€’2mo ago
will requests be routed to this old container?
IgnisDa
IgnisDaOPβ€’2mo ago
its not working btw
No description
Solution
Fragly
Fraglyβ€’2mo 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)
Fragly
Fraglyβ€’2mo ago
in what way is it not working? Does the previous container get removed regardless?
IgnisDa
IgnisDaOPβ€’2mo ago
yes it does
Fragly
Fraglyβ€’2mo ago
can you try redeploying again
IgnisDa
IgnisDaOPβ€’2mo ago
unfortunately the background job itself is written in a way that it is not resumable. so this is not very helful for me i did project id: 6ef7539d-c186-4609-a904-178fd8fa7fa0
Fragly
Fraglyβ€’2mo ago
it wouldn't have to resume because you would never have to pause it Strange, perhaps it's above the max amount? I completely forgot what the max amount is πŸ˜”
IgnisDa
IgnisDaOPβ€’2mo ago
its not mentioned on the docs as well i set it to 3600, still does not work
Brody
Brodyβ€’2mo ago
you want draining not overlap
Fragly
Fraglyβ€’2mo ago
this then
IgnisDa
IgnisDaOPβ€’2mo ago
yep that seems to be working is there a max value to this? can i set it to 20k?
Brody
Brodyβ€’2mo ago
5.5hr should be fine
IgnisDa
IgnisDaOPβ€’2mo ago
alright thanks
Want results from more Discord servers?
Add your server