2 years ago
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"
36 Replies
2 years ago
will get you this tomorrow
2 years ago
Endpoint
https://backboard.railway.app/graphql/internalQuery
mutation serviceInstanceUpdate($serviceId: String!, $environmentId: String, $input: ServiceInstanceUpdateInput!) {
serviceInstanceUpdate(serviceId: $serviceId, environmentId: $environmentId, input: $input)
}Variables
{
"serviceId": "",
"environmentId": "",
"input": {
"numReplicas": 2
}
}2 years ago
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
2 years ago
yeah you can't update the replica value with the public endpoint
2 years ago
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 🙂
2 years ago
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?
2 years ago
doing that mutation should trigger a re-deploy
2 years ago
I mean it did it my tests, well now I'm second guessing myself
2 years ago
I'm probably wrong, you'd want the serviceInstanceRedeploy mutation in that case then
it 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
2 years ago
yes that's definitely intentional
2 years ago
no problem, if you need anything else don't be afraid to ask
2 years ago
I think this not being in the public api is an oversight.
2 years ago
The internal api is… well, internal.
2 years ago
I’ll try to fix this soon.
2 years ago
I should proably start using this
2 years ago
When a store installs my app, initially there's a burst of activity, I need to sync a bunch of data
2 years ago
for small stores this is handled with the worker I use for most tasks
2 years ago
but for a large store, it's not enough
2 years ago
I'de like to maybe play with this API if it's available?
2 years ago
theres no auto scaling, even with the api, the original poster intended to roll their own auto scaler
2 years ago
yeah I could do that
2 years ago
if (new_store_is_large)
add_worker_replica(2, for: 3.hours)2 years ago
new_store_is_large 🤣
2 years ago
hehe
2 years ago
i mean I just had to handle 35k records added to the DB >.<
2 years ago
that was heavy when you're using an ORM like ActiveRecord
2 years ago
and my web process getting pinged hard from all the webhook events for this store … groans in developer
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