Publish a new version of your Subgraph with the standard Graph CLI and query it through GraphOps before your application depends on it. The Deployment CID that Graph CLI prints is the input to every next step: a query endpoint, a Managed Subgraph, or an Endpoint Alias target.
Prerequisites
- A working Subgraph project with
subgraph.yaml. - The standard Graph CLI installed for your project.
- Access to the Graph Network or publishing destination used by your Subgraph.
- A GraphOps organization with Subgraphs access and a Subgraphs API key.
Deploy
Generate types
graph codegenBuild the Subgraph
graph buildPublish the Subgraph
Run the deployment command for your Graph CLI target. For example:
graph deploy <SUBGRAPH_SLUG>Copy the Deployment CID from the command output and record it with the release.
Choose query access or managed indexing
For a deployment available through The Graph Network, use its CID in the query endpoint:
https://subgraphs.graphops.xyz/v1/deploymentCID/<DEPLOYMENT_CID>To have GraphOps run indexing instead, create a Managed Subgraph with the CID and query it through the same endpoint shape once it is indexed.
Check the deployment
curl "https://subgraphs.graphops.xyz/v1/deploymentCID/<DEPLOYMENT_CID>" \
-H "Authorization: Bearer <GRAPHOPS_API_KEY>" \
-H "Content-Type: application/json" \
--data '{
"query": "query DeploymentStatus { _meta { deployment block { number hash } hasIndexingErrors } }"
}'Response
{ "data": { "_meta": { "deployment": "Qm...",Should match the CID from graph deploy "block": { "number": 18000000,Rises as the new deployment indexes "hash": "0x..." }, "hasIndexingErrors": falseMust stay false before you release } }}_meta.block.number rises while the new deployment indexes. Query your application's fields only
after it reaches the blocks your application needs.
Release the new version
- Test the new deployment through its Deployment CID endpoint before you change a production Endpoint Alias.
- Move clients with Manage Endpoint Aliases, or promote it as the Next version of a Managed Subgraph.
- Keep the previous Deployment CID as a rollback target.
- Check
_meta.hasIndexingErrorsafter publishing and after each Endpoint Alias update.