Stop and Re-Deploy a Service/Project using CLI
ariasortez
HOBBYOP

a year ago

Hi there,
Hope you are doing well.

I'm wondering if someone knows how to stop a service/project and re-deploy a stopped service/project using the CLI.

Thanks in advance.

7 Replies

a year ago

Hello,

Have you checked out what railway --help would print out?

railway down and railway redeploy should do what you want.


ariasortez
HOBBYOP

a year ago

Hi Brody,

Thanks for getting back to me. I've tried both but there is an issue with the railway redeploy as to when I try to redeploy a service/project that was removed (I use this option to stop the service) the CLI says that it wasn't able to find an active deployment or something like that. Therefore, I'm not sure if there is an option to redeploy removed/cancelled services/projects that were removed after deploying.

Hope this explains a bit better my question.


a year ago

Maybe app sleeping is better in this case? I'm not sure, what is your use case if you don't mind me asking?


ariasortez
HOBBYOP

a year ago

Sure! I've developed a Node.js app which serves as a BOT. The bot must be active from 7:00 AM to 1:00 AM. I want it to be automatically deployed and removed within this timeframe so, in other words, I want the bot the be deployed from 7 to 1 AM and removed from 1:AM to 7:AM next day.

Do you mind helping me with the sleeping process? It seems something that might works for me if you don't mind!


a year ago

App sleep does not work for bots, only web services like a website or API.

Why not code your bot bring itself offline or not reply when you don't need it to?

For this use case, I personally don't think you should rely on the platform to handle this for you.


ariasortez
HOBBYOP

a year ago

Gotcha! It's kinda an API so it might work. Any chance you have a document I can check? Thanks again for your help!


a year ago

It unlikely to work, the bot connecting to Discord's API will keep it alive, not to mention that it doesnt help what so ever with starting and stopping at a set time.

https://docs.railway.com/reference/app-sleeping


Loading...