How to setup idle project and stop deduct the credit?
weilies
HOBBYOP

5 months ago

I am hobbyist developer, recently found railway but often learn new tools during weekends.

Noticed the credit is auto deducted even I ain't using. I suspect due to its online 24/7.

Possible I set my project offline and only startup when I really wanna use?

$10 Bounty

6 Replies

You can create a function in Railway that runs every weekend that calls a Public API endpoint that will remove/create deployments for a service.


5 months ago

In addition to the previous comment, you can make your service serverless in settings so that it "turns off" when not in use and turns back on when an incoming request needs to be processed

You can read more here: https://docs.railway.com/reference/app-sleeping#how-it-works


ilyassbreth
FREE

5 months ago

so the serverless mode answer is correct but here's the gotcha, even with serverless enabled your app won't actually sleep if it's making any outbound requests. stuff like db connection pools staying open, any telemetry/analytics, cron jobs, or health checks will keep it awake 24/7 burning credits

so enable serverless in settings but also make sure your app isn't constantly pinging stuff when idle. close db connections after ~10 mins of no activity

also set a hard limit ($10 minimum) in workspace > usage settings as a safety net. railway will shut everything down when you hit it so you don't get surprised charges

this combo should let you actually go idle on weekends without bleeding credits


ilyassbreth

so the serverless mode answer is correct but here's the gotcha, even with serverless enabled your app won't actually sleep if it's making any outbound requests. stuff like db connection pools staying open, any telemetry/analytics, cron jobs, or health checks will keep it awake 24/7 burning credits so enable serverless in settings but also make sure your app isn't constantly pinging stuff when idle. close db connections after \~10 mins of no activity also set a hard limit ($10 minimum) in workspace > usage settings as a safety net. railway will shut everything down when you hit it so you don't get surprised charges this combo should let you actually go idle on weekends without bleeding credits

I'd probably just cron something that removes deployments... A lot easier imo

But yeah definitely set a hard limit to avoid paying more than a specific amount.


0x5b62656e5d

I'd probably just cron something that removes deployments... A lot easier imo But yeah definitely set a hard limit to avoid paying more than a specific amount.

ilyassbreth
FREE

5 months ago

enabling serverless in settings so it sleeps when idle, and definitely set a hard limit ($10 min) in workspace > usage as a safety net. serverless should handle his weekend-only use case perfectly


weilies
HOBBYOP

4 months ago

-ignore plz..-


Welcome!

Sign in to your Railway account to join the conversation.

Loading...