4 months ago
Hello,
Not an issue, but a possible enhancement for my service 🙂
I have a nestjs service running with 3 replicas.
I would like to enable the 3 replicas only during afternoon times and during the morening and night times, keep a signle replica.
Would that be possible?
12 Replies
4 months ago
https://github.com/railwayapp/cli/blob/master/src/commands/scale.rs
Think you can use the Railway CLI to modify the amount of replicas
Status changed to Solved brody • 4 months ago
4 months ago
On that, the CLI interacts via graphql so you are able to do it that way too
I checked and indeed can be manually triggered from the CLI. But is it possible to do it automatically?
4 months ago
There is no first party way to do this right now. You would have to set up an automation with the graphql public api
Unfortunately, I could not find any similar implementation, documentation or example to scale replicas.
Do you have any info for the same?
4 months ago
Pepper has linked the source code for the scale command above.
4 months ago
The code shows you how to use the API to scale up or down a Railway service. You can take that code, rewrite it into a language you are comfortable with, mix in your own business logic, and you will eventually come to the solution you want.
4 months ago
You can probably spin up a secondary service in Railway where it only calls the CLI/GraphQL endpointse periodically based on cron jobs
And here comes my point. Which is the endpoint for scaling?
I could not find any reference…
4 months ago
The CLI is open source; you can see what GQL calls it makes and to where.