R
Railway4mo ago
_mati

Is there a cron job to re-deploy services?

Hey guys! So, I have some 3rd party services that are using too much RAM (no memory spikes, it slowly increases and then keeps consistent). As I can't edit the code, it came to my mind that I can restart them every 24 hours. I was planning to use the Railway's API to achieve this, but then I thought there might be a cron job for this :) PS: Just out of curiosity, does the V2 runtime improve the RAM consumption or is it indifferent?
33 Replies
Percy
Percy4mo ago
Project ID: N/A
_mati
_matiOP4mo ago
N/A lol I found this: https://railway.app/template/fwH-l3 brody you're the goat will give it a try
Brody
Brody4mo ago
hell yeah, let me know if you have any questions
_mati
_matiOP4mo ago
man I don't know how much Railway is paying you but it's not enough it works really well thank you so much
Brody
Brody4mo ago
no problem!
_mati
_matiOP4mo ago
hey brody, is this project open source by any chance? I'd like to implement a retry system, since I'm getting these errors, which look more like a Railway's API issue
No description
_mati
_matiOP4mo ago
some services got redeployed, but most of them actually not the services do exist, and I'm checking the SCHEDULE_N with the Cron Config bookmark and it's exactly the same, that's why I think it may be a Railway's issue (also because of the 503 status code lol)
Brody
Brody4mo ago
it is, follow the source of the template service do you know go? looks like you where the first ever to report this issue - https://discord.com/channels/713503345364697088/1270868312091394088/1271422392203218954 but the code should do retries for a minute or however many minutes you are okay with the cron running late.
_mati
_matiOP4mo ago
I do
Brody
Brody4mo ago
perfect, what retry package are you thinking of?
_mati
_matiOP4mo ago
at my job we use https://github.com/cenkalti/backoff but happy to give a try to this one https://github.com/avast/retry-go which looks simpler wdyt?
Brody
Brody4mo ago
if you are more familiar with backoff then you can use that, just make sure not to hammer the api and set a max time before "giving up"
_mati
_matiOP4mo ago
sure what's the best way to test this?
Brody
Brody4mo ago
_mati
_matiOP4mo ago
I added the backoff retry, but I can't create PRs in your repo
Brody
Brody4mo ago
oh why not?
_mati
_matiOP4mo ago
nvm, created a PR from my fork
Brody
Brody4mo ago
cool, I'll look over it tonight
_mati
_matiOP4mo ago
will be using the fork for now to see how it goes will keep you posted
Brody
Brody4mo ago
have you tested your retries with this that returns 503
_mati
_matiOP4mo ago
hey man! sorry I was off during the weekend I updated the template in my project, but still having some issues: - The 503 issue is still there, not sure what could be causing it. I think I will try by changing the backoff params, but if it keeps returning 503 errors, the retry system is kind of useless. - I think the os.Exit() after a request fails could be removed. Maybe it failed to redeploy a service, but I want it to keep trying with all the other services in the list instead of restarting the container. What do you think? Here's the project ID, just in case: b27fab0d-135f-4876-afbe-34e83cad72ac
No description
Brody
Brody4mo ago
The 503 issue is still there
different error handling logic is not going to fix issues with the backboard.
I think the os.Exit() after a request fails could be removed.
agree, changed, image built.
_mati
_matiOP4mo ago
Yeah, still getting the 503 issue. I'll try changing the schedule of the cron jobs so they're not performed all at the same time they're all being executed concurrently? could I add a delay of 30 seconds between each execution to see if this solves the issue?
Brody
Brody4mo ago
how many schedules are you running?
_mati
_matiOP4mo ago
around 50
Brody
Brody4mo ago
why??
_mati
_matiOP4mo ago
because I have multiple projects using Chatwoot and I want to restart them at 6am UTC
Brody
Brody4mo ago
why do you need to restart Chatwoot?
_mati
_matiOP4mo ago
the RAM usage is too high in some cases and when I redeploy them, it decreases I just don't want to manually redeploy them
Brody
Brody4mo ago
yeah, then try adjusting the schedules to stagger the restarts
_mati
_matiOP4mo ago
it worked after staggering the redeploys :) thank you
Brody
Brody4mo ago
then I think you where getting rate limited
Want results from more Discord servers?
Add your server