Skip to content
Does Railway GraphQL expose all active and draining deployment instances?
zeeshan4779
OP

a month ago

Hello Railway team,

I'm trying to determine whether Railway's GraphQL API provides an authoritative inventory of all currently running, stopping, and draining service instances.

I queried Query.deployments with project, environment, and service filters, includeDeleted: true, and complete cursor pagination.

The results included 431 deployment records, with one expected RUNNING instance and no additional active or REMOVING instances.

I have four questions:

  1. Does Deployment.instances include every instance that is still running, serving traffic, draining, or shutting down, including instances belonging to superseded deployments?
  2. Does the DeploymentInstanceStatus.REMOVING state cover the entire graceful-draining period?
  3. Are instances created or removed during replica scaling, host migration, or platform-initiated replacement always represented in this API?
  4. If this API cannot guarantee complete coverage, is there another read-only Railway API or supported method that provides an authoritative current inventory?

I'm specifically looking for confirmation of the API's coverage and guarantees, rather than troubleshooting an application failure.

A response from a Railway engineer familiar with the deployment lifecycle would be especially helpful.

Thank you.

Solved

1 Reply

Status changed to Awaiting Railway Response Railway • about 1 month ago


chandrika
EMPLOYEE

a month ago

Each deployment's instances field returns all of that deployment's instance records, whatever their status. An older deployment's instances only appear when you query that deployment, so enumerating every deployment the way you did is the correct way to cover superseded ones.

REMOVING does not cover graceful draining. While an old deployment drains after the shutdown signal, its instances keep their previous status, usually RUNNING. REMOVING is set only once removal of the container actually starts, and it moves to REMOVED as soon as removal finishes. So during the overlap/draining window you can't use REMOVING to spot draining instances. Look for RUNNING instances on deployments that have been superseded instead.

New replicas from scaling and platform-initiated replacements get an instance record before their container is created. Instance statuses are updated asynchronously from the container runtime, though, so for a short time they can lag behind what is actually happening on the host. The API gives you a close-to-current view, but it isn't a strictly real-time or guaranteed-complete inventory.

There's no other public read-only API for instance inventory. GraphQL deployment instances are the only supported source.


Status changed to Awaiting User Response chandrika • about 1 month ago


Status changed to Solved zeeshan4779 • about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...