R
Railwayβ€’4w 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β€’4w ago
Project ID: N/A
IgnisDa
IgnisDaβ€’4w ago
N/A
Fragly
Fraglyβ€’4w ago
You can extend how long previous containers keep running, but you can't keep them running indefinitely
IgnisDa
IgnisDaβ€’4w 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β€’4w 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
IgnisDaβ€’4w ago
the docs on this env variable are lacking. what does overlap here mean?
No description
Fragly
Fraglyβ€’4w 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
IgnisDaβ€’4w ago
will requests be routed to this old container?
IgnisDa
IgnisDaβ€’4w ago
its not working btw
No description
Solution
Fragly
Fraglyβ€’4w 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β€’4w ago
in what way is it not working? Does the previous container get removed regardless?
IgnisDa
IgnisDaβ€’4w ago
yes it does
Fragly
Fraglyβ€’4w ago
can you try redeploying again
IgnisDa
IgnisDaβ€’4w 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β€’4w 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
IgnisDaβ€’4w ago
its not mentioned on the docs as well i set it to 3600, still does not work
Brody
Brodyβ€’4w ago
you want draining not overlap
Fragly
Fraglyβ€’4w ago
this then
IgnisDa
IgnisDaβ€’4w ago
yep that seems to be working is there a max value to this? can i set it to 20k?
Brody
Brodyβ€’4w ago
5.5hr should be fine
IgnisDa
IgnisDaβ€’4w ago
alright thanks
Want results from more Discord servers?
Add your server