R
Railway16mo ago
lasse

Redeploy

Hey there, is there away to start a redploy using the Railway API
37 Replies
Percy
Percy16mo ago
Project ID: N/A
lasse
lasseOP16mo ago
n/a
Brody
Brody16mo ago
yes there is, what's the usecase?
lasse
lasseOP16mo ago
So the case is i want to redeploy it every 24 hours, if that is allowed
Brody
Brody16mo ago
okay but what's the reason you want to do that
lasse
lasseOP16mo ago
Better performance for my discord bot.
fedev
fedev16mo ago
Railway has a built in cron service redeployer Service => settings => chron schedule
0 0 * * *
0 0 * * *
this should redeploy your service every day at 12AM
lasse
lasseOP16mo ago
Thank you!
Brody
Brody16mo ago
that will not do what they want it won't restart because something will already be running
fedev
fedev16mo ago
But i tried it and it re deployed my service even if it was already running
Brody
Brody16mo ago
did the status say complete?
fedev
fedev16mo ago
It was active and then it removed the previous deployment
Brody
Brody16mo ago
the changelog said they have changed that behaviour to wait for previous deployments to complete
fedev
fedev16mo ago
What do you mean for complete? The is a complete state? Isn't there removed, failed, active, building and initializing ?
Brody
Brody16mo ago
you missed deploying and complete railways cron scheduler will skip a schedule if there is already a deployment in the active state, at least according to their changelog prom the previous week
fedev
fedev16mo ago
I will try it again to be sure then
Brody
Brody16mo ago
https://railway.app/changelog/2023-08-11-cron-jobs-generally-available
We now skip job execution if a previous cron is still running
assuming that's true, you would not be able to use cron to restart a discord bot because it would be running when the next job starts, thus getting skipped
ferret
ferret16mo ago
i'm just wondering why you would need to restart it. i run probably 10+ discord bots on railway with no performance issues over time
Brody
Brody16mo ago
I wasn't gonna open that can of worms
ferret
ferret16mo ago
fair
Brody
Brody16mo ago
I was still curious though
fedev
fedev16mo ago
probably worked for me because the first deployent was from github and then it redeployed from the cron?
Brody
Brody16mo ago
no that wouldn't be the case if you are right and the cron did stop execution of your previously active state deployment then that is a bug unless you are confusing active with completed
fedev
fedev16mo ago
don't understand what you mean for completed but it just redeployed for me I made some screenshots one sec
Brody
Brody16mo ago
deployments can have many states, one of which would be "completed" this state is for when your app exits with a non error code, and according to the changelog a cron schedule would be skipped if your deployment is not in this state when the schedule is going to run
fedev
fedev16mo ago
mine was in "active" state not "completed"
fedev
fedev16mo ago
Cron was scheaduled to run at minute 30 of every hour
Brody
Brody16mo ago
what kind of app is this
fedev
fedev16mo ago
a websocket server
Brody
Brody16mo ago
interesting and why do you restart that?
fedev
fedev16mo ago
I dont restart it, i was just testing the cron functionality for @lasse
Brody
Brody16mo ago
ah gotcha
lasse
lasseOP16mo ago
I run into some, its in 500 servers. But dont know with yours
ferret
ferret16mo ago
ah
Brody
Brody16mo ago
okay well obviously the best solution would be to fix the performance issues, if that's out of the question, try railways cron, if that doesn't do it, I have another solution that uses the railway api to restart your service in the form of a template
lasse
lasseOP16mo ago
It's working
lasse
lasseOP16mo ago
Want results from more Discord servers?
Add your server