Deploy a new version of your SubQuery project

... 2022-8-5 About 2 min

# Deploy a new version of your SubQuery project

# Guidelines

Although you have the freedom to always upgrade and deploy new versions of your SubQuery project, please be considerate during this process if your SubQuery project is public for the world. Some key points to note:

  • If your upgrade is a breaking change, either create a new project (e.g. My SubQuery Project V2) or give your community plenty of warning of the change through social media channels.
  • Deploying a new SubQuery project version causes some downtime as the new version indexes the complete chain from the genesis block.

# Deploy Changes

There are two methods to deploy a new version of your project to the SubQuery Managed Service, you can use the UI or directly via the subql cli tool.

# Using the UI

Log into SubQuery Project and select the project you want to deploy a new version of. You can choose to either deploy to the production or staging slot. These two slots are isolated environments and each has their own databases and synchronise independently.

We recommend deploying to your staging slot only for final staging testing or when you need to resync your project data. You can then promote it to production with zero downtime. You will find testing is faster when running a project locally as you can more easily debug issues.

The staging slot is perfect for:

  • Final validation of changes to your SubQuery Project in a separate environment. The staging slot has a different URL to production that you can use in your dApps.
  • Warming up and indexing data for an updated SubQuery project to eliminate downtime in your dApp.
  • Preparing a new release for your SubQuery Project without exposing it publicly. The staging slot is not shown to the public in the Explorer and has a unique URL that is visible only to you.

Staging slot

Fill in the Commit Hash from GitHub (copy the full commit hash) of the version of your SubQuery project codebase that you want deployed. This will cause a longer downtime depending on the time it takes to index the current chain. You can always report back here for progress.

# Using the CLI

You can also use @subql/cli to create a new deployment of your project to our managed service. This requires:

// You can directly set your Indexer and Query versions
$ subql deployment:deploy --indexerVersion=1.1.2 --queryVersion=1.1.1

// OR you can use the interface, it will validate your IPFS CID and render a list of image versions that matches your manifest file `project.yaml`

$ subql deployment:deploy

# Upgrade to the Latest Indexer and Query Service

If you just want to upgrade to the latest indexer (@subql/node (opens new window)) or query service (@subql/query (opens new window)) to take advantage of our regular performance and stability improvements, just select a newer versions of our packages and save. This will cause only a few minutes of downtime as the services running your project are restarted.

# Next Steps - Connect to your Project

Once your deployment has succesfully completed and our nodes have indexed your data from the chain, you'll be able to connect to your project via the displayed GraphQL Query endpoint.

Project being deployed and synced

Alternatively, you can click on the three dots next to the title of your project, and view it on SubQuery Explorer. There you can use the in browser playground to get started - read more about how to use our Explorer here.

Last update: August 5, 2022 10:08