Restarting a service from API
lrrrrr
PROOP

2 years ago

Is there a reliable way to restart a service with the API? I am using deploymentRestart now, which works fine, but it takes the deployment ID which will keep changing…

Solved

4 Replies

2 years ago

Services are just where the deployments reside, for you to restart a service means to restart the deployment within that service.

Your best bet would be to call the API to get a list of deployments for a given service and then filter by date and status so that you will always have the latest deployment ID for a given service.

But I'm quite curious now, mind sharing your usecase?


Status changed to Solved Railway almost 2 years ago


lrrrrr
PROOP

2 years ago

Thanks for the tip. That worked.

I use it for apps with memory leaks, and for an app which randomly stops working.


2 years ago

Then may I introduce to you my template - https://railway.app/template/fwH-l3

It should do exactly what you need, It restarts the latest deployment for a given service on a set schedule.


lrrrrr
PROOP

2 years ago

Thanks! I have my automations all set up now, but I'm sure this will come in handy at some point.


Loading...