How to change the number of replicas via API?
1) the API introspection in postman does not seem to know about the possibility of updating numReplicas (parsed from dashboard requests
2) I am new to gql so I tried a req that would work:
mutation serviceInstanceUpdate {
serviceInstanceUpdate(
serviceId: "ID",
input: { healthcheckTimeout: 300 }
)
}
but doing the same for numReplicas fails:
mutation serviceInstanceUpdate {
serviceInstanceUpdate(
serviceId: "ID",
input: { numReplicas: 5 }
)
}
with "message": "Problem processing request"
21 Replies
will get you this tomorrow
Solution
Endpoint
Query
Variables
let me know if you need help with anything else, and sorry this took so long
ooh, so I have to go through the internal API, ok I was using the public API endpoint
https://backboard.railway.app/graphql/v2
yeah you can't update the replica value with the public endpoint
internal endpoint accepts the same token though
that was my next question, if the auth is the same, thanks!
I suspect the internal may change more frequently 🙂
yes it would
I can see that just updating the numreplicas has no effect (other than changing the setting), so I have to trigger a deploy to make it actually stick, right?
serviceInstanceRedeploy
mutation in that case thenit does not for me, the dashboard changes showing new number of replicas, but redeploy does not happen
just a side note, the internal endpoint does not seem to support introspection, not sure if that is intentional
yes that's definitely intentional
thanks a lot, I think I have all I need now
no problem, if you need anything else don't be afraid to ask
I think this not being in the public api is an oversight.
The internal api is… well, internal.
I’ll try to fix this soon.
I should proably start using this
When a store installs my app, initially there's a burst of activity, I need to sync a bunch of data
for small stores this is handled with the worker I use for most tasks
but for a large store, it's not enough
I'de like to maybe play with this API if it's available?
theres no auto scaling, even with the api, the original poster intended to roll their own auto scaler
yeah I could do that
new_store_is_large
🤣hehe
i mean I just had to handle 35k records added to the DB >.<
that was heavy when you're using an ORM like ActiveRecord
and my web process getting pinged hard from all the webhook events for this store ... groans in developer
any headwind on this?
serviceInstance(environmentId: $environmentId, serviceId: $serviceId) {\n __typename\n buildCommand\n builder\n createdAt\n cronSchedule\n deletedAt\n # domains\n environmentId\n healthcheckPath\n healthcheckTimeout\n id\n isUpdatable\n # latestDeployment\n nextCronRunAt\n nixpacksPlan\n numReplicas\n railwayConfigFile\n region\n restartPolicyMaxRetries\n restartPolicyType\n rootDirectory\n serviceId\n sleepApplication\n # source\n startCommand\n updatedAt\n upstreamUrl\n watchPatterns\n }\n}", "variables": "{\n\t"environmentId": null,\n\t"serviceId": null\n}"}}, "url": {"raw": "https://backboard.railway.app/graphql/v2", "protocol": "https", "host": ["backboard", "railway", "app"], "path": ["graphql", "v2"]}, "description": "Get a service instance
i can only see numreplicas in the service instance