-
Notifications
You must be signed in to change notification settings - Fork 155
Deploy subgraph #788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Deploy subgraph #788
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3a11d06
potential changes
idalithb a1dc3be
Deploying-a -subgraph
idalithb 5c0c663
Edits
idalithb d1a319f
added image
idalithb 09dcb08
deleting page
idalithb bec2d52
some updates
idalithb 5ba486e
updating
idalithb a92c6e3
updates
idalithb 08b2f23
updating pages
idalithb 1daf3ac
Update website/pages/ar/deploying/deploy-using-subgraph-studio.mdx
idalithb b00c0cd
Update website/pages/ar/deploying/deploy-using-subgraph-studio.mdx
idalithb 0c1ec01
Update website/pages/ar/deploying/deploy-using-subgraph-studio.mdx
idalithb f114d39
Update website/pages/ar/deploying/deploy-using-subgraph-studio.mdx
idalithb 52a4059
minor adjustments
idalithb 0302801
attempting to fix
idalithb 85ae19f
Merge branch 'main' into deploy-subgraph
benface File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
website/pages/ar/deploying/deploy-using-subgraph-studio.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
--- | ||
title: Deploy Using Subgraph Studio | ||
--- | ||
|
||
Learn how to deploy your subgraph to Subgraph Studio. | ||
|
||
> Note: When you deploy a subgraph, you push it to Subgraph Studio, where you'll be able to test it. It's important to remember that deploying is not the same as publishing. When you publish a subgraph, you're publishing it on-chain. | ||
## Subgraph Studio Overview | ||
|
||
In [Subgraph Studio](https://thegraph.com/studio/), you can do the following: | ||
|
||
- View a list of subgraphs you've created | ||
- Manage, view details, and visualize the status of a specific subgraph | ||
- Create and manage your API keys for specific subgraphs | ||
- Restrict your API keys to specific domains and allow only certain Indexers to query with them | ||
- Create your subgraph through the Studio UI | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- Deploy your subgraph using the The Graph CLI | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- Test your subgraph in the playground environment | ||
- Integrate your subgraph in staging using the development query URL | ||
- Publish your subgraph with the Studio UI | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- Manage your billing | ||
|
||
## Install The Graph CLI | ||
|
||
Before deploying, you must install The Graph CLI. | ||
|
||
You must have [Node.js](https://nodejs.org/) and a package manager of your choice (`npm`, `yarn` or `pnpm`) installed to use The Graph CLI. Check for the [most recent](https://github.com/graphprotocol/graph-tooling/releases?q=%40graphprotocol%2Fgraph-cli&expanded=true) CLI version. | ||
|
||
**Install with yarn:** | ||
idalithb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
yarn global add @graphprotocol/graph-cli | ||
``` | ||
|
||
**Install with npm:** | ||
|
||
```bash | ||
npm install -g @graphprotocol/graph-cli | ||
``` | ||
|
||
## Create Your Subgraph | ||
|
||
Before deploying your subgraph you need to create an account in [Subgraph Studio](https://thegraph.com/studio/). | ||
idalithb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
1. Open [Subgraph Studio](https://thegraph.com/studio/). | ||
2. Connect your wallet to sign in. | ||
- You can do this via MetaMask, Coinbase Wallet, WalletConnect, or Safe. | ||
3. After you sign in, your unique deploy key will be displayed on your subgraph details page. | ||
- The deploy key allows you to publish your subgraphs or manage your API keys and billing. It is unique but can be regenerated if you think it has been compromised. | ||
|
||
> Important: You need an API key to query subgraphs | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
### How to Create a Subgraph in Subgraph Studio | ||
|
||
<VideoEmbed youtube="nGIFuC69bSA" /> | ||
|
||
> For additional written detail, review the [Quick-Start](/quick-start/). | ||
idalithb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
### Subgraph Compatibility with The Graph Network | ||
|
||
In order to be supported by Indexers on The Graph Network, subgraphs must: | ||
|
||
- Index a [supported network](/developing/supported-networks) | ||
- Must not use any of the following features: | ||
- ipfs.cat & ipfs.map | ||
- Non-fatal errors | ||
- Grafting | ||
|
||
## Initialize Your Subgraph | ||
|
||
Once your subgraph has been created in Subgraph Studio, you can initialize its code through the CLI using this command: | ||
|
||
```bash | ||
graph init --studio <SUBGRAPH_SLUG> | ||
``` | ||
|
||
You can find the `<SUBGRAPH_SLUG>` value on your subgraph details page in Subgraph Studio, see image below: | ||
idalithb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
 | ||
|
||
After running `graph init`, you will be asked to input the contract address, network, and an ABI that you want to query. This will generate a new folder on your local machine with some basic code to start working on your subgraph. You can then finalize your subgraph to make sure it works as expected. | ||
|
||
## Graph Auth | ||
|
||
Before you can deploy your subgraph to Subgraph Studio, you need to login into your account within the CLI. To do this, you will need your deploy key, which you can find under your subgraph details page. | ||
idalithb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Then, use the following command to authenticate from the CLI: | ||
|
||
```bash | ||
graph auth --studio <DEPLOY KEY> | ||
``` | ||
|
||
## Deploying a Subgraph | ||
|
||
Once you are ready, you can deploy your subgraph to Subgraph Studio. | ||
|
||
> Deploying a subgraph with the CLI pushes it to the Studio, where you can test it and and update the metadata. This action won't publish your subgraph to the decentralized network. | ||
Use the following CLI command to deploy your subgraph: | ||
|
||
```bash | ||
graph deploy --studio <SUBGRAPH_SLUG> | ||
``` | ||
|
||
After running this command, the CLI will ask for a version label. | ||
|
||
- It's strongly recommended to use [semver](https://semver.org/) for versioning like `0.0.1`. That said, you are free to choose any string as version such as `v1`, `version1`, or `asdf`. | ||
- The labels you create will be visible in Graph Explorer and can be used by curators to decide if they want to signal on a specific version or not, so choose them wisely. | ||
|
||
## Testing Your Subgraph | ||
|
||
After deploying, you can test your subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. | ||
|
||
Use Subgraph Studio to check the logs on the dashboard and look for any errors with your subgraph. | ||
|
||
## Publish Your Subgraph | ||
|
||
In order to publish your subgraph successfully, review [publishing a subgraph](/publishing/publishing-a-subgraph/). | ||
|
||
## Versioning Your Subgraph with the CLI | ||
|
||
If you want to update your subgraph, you can do the following: | ||
|
||
- You can deploy a new version to Studio using the CLI (it will only be private at this point). | ||
- Once you're happy with it, you can publish your new deployment to [Graph Explorer](https://thegraph.com/explorer). | ||
- This action will create a new version of your subgraph that Curators can start signaling on and Indexers can index. | ||
|
||
You can also update your subgraph's metadata without publishing a new version. You can update your subgraph details in Studio (under the profile picture, name, description, etc.) by checking an option called **Update Details** in Graph Explorer. If this is checked, an on-chain transaction will be generated that updates subgraph details in Explorer without having to publish a new version with a new deployment. | ||
|
||
> Note: There are costs associated with publishing a new version of a subgraph to the network. In addition to the transaction fees, you must also fund a part of the curation tax on the auto-migrating signal. You cannot publish a new version of your subgraph if Curators have not signaled on it. For more information, please read more [here](/network/curating/). | ||
## Automatic Archiving of Subgraph Versions | ||
|
||
Whenever you deploy a new subgraph version in Subgraph Studio, the previous version will be archived. Archived versions won't be indexed/synced and therefore cannot be queried. You can unarchive an archived version of your subgraph in Subgraph Studio. | ||
|
||
> Note: Previous versions of non-published subgraphs deployed to Studio will be automatically archived. | ||
 |
68 changes: 0 additions & 68 deletions
68
website/pages/ar/deploying/deploying-a-subgraph-to-studio.mdx
This file was deleted.
Oops, something went wrong.
139 changes: 139 additions & 0 deletions
139
website/pages/cs/deploying/deploy-using-subgraph-studio.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
--- | ||
title: Deploy Using Subgraph Studio | ||
--- | ||
|
||
Learn how to deploy your subgraph to Subgraph Studio. | ||
|
||
> Note: When you deploy a subgraph, you push it to Subgraph Studio, where you'll be able to test it. It's important to remember that deploying is not the same as publishing. When you publish a subgraph, you're publishing it on-chain. | ||
## Subgraph Studio Overview | ||
|
||
In [Subgraph Studio](https://thegraph.com/studio/), you can do the following: | ||
|
||
- View a list of subgraphs you've created | ||
- Manage, view details, and visualize the status of a specific subgraph | ||
- Create and manage your API keys for specific subgraphs | ||
- Restrict your API keys to specific domains and allow only certain Indexers to query with them | ||
- Create your subgraph through the Studio UI | ||
- Deploy your subgraph using the The Graph CLI | ||
- Test your subgraph in the playground environment | ||
- Integrate your subgraph in staging using the development query URL | ||
- Publish your subgraph with the Studio UI | ||
- Manage your billing | ||
|
||
## Install The Graph CLI | ||
|
||
Before deploying, you must install The Graph CLI. | ||
|
||
You must have [Node.js](https://nodejs.org/) and a package manager of your choice (`npm`, `yarn` or `pnpm`) installed to use The Graph CLI. Check for the [most recent](https://github.com/graphprotocol/graph-tooling/releases?q=%40graphprotocol%2Fgraph-cli&expanded=true) CLI version. | ||
|
||
**Install with yarn:** | ||
|
||
```bash | ||
yarn global add @graphprotocol/graph-cli | ||
``` | ||
|
||
**Install with npm:** | ||
|
||
```bash | ||
npm install -g @graphprotocol/graph-cli | ||
``` | ||
|
||
## Create Your Subgraph | ||
|
||
Before deploying your subgraph you need to create an account in [Subgraph Studio](https://thegraph.com/studio/). | ||
|
||
1. Open [Subgraph Studio](https://thegraph.com/studio/). | ||
2. Connect your wallet to sign in. | ||
- You can do this via MetaMask, Coinbase Wallet, WalletConnect, or Safe. | ||
3. After you sign in, your unique deploy key will be displayed on your subgraph details page. | ||
- The deploy key allows you to publish your subgraphs or manage your API keys and billing. It is unique but can be regenerated if you think it has been compromised. | ||
|
||
> Important: You need an API key to query subgraphs | ||
### How to Create a Subgraph in Subgraph Studio | ||
|
||
<VideoEmbed youtube="nGIFuC69bSA" /> | ||
|
||
> For additional written detail, review the [Quick-Start](/quick-start/). | ||
### Subgraph Compatibility with The Graph Network | ||
|
||
In order to be supported by Indexers on The Graph Network, subgraphs must: | ||
|
||
- Index a [supported network](/developing/supported-networks) | ||
- Must not use any of the following features: | ||
- ipfs.cat & ipfs.map | ||
- Non-fatal errors | ||
- Grafting | ||
|
||
## Initialize Your Subgraph | ||
|
||
Once your subgraph has been created in Subgraph Studio, you can initialize its code through the CLI using this command: | ||
|
||
```bash | ||
graph init --studio <SUBGRAPH_SLUG> | ||
``` | ||
|
||
You can find the `<SUBGRAPH_SLUG>` value on your subgraph details page in Subgraph Studio, see image below: | ||
|
||
 | ||
|
||
After running `graph init`, you will be asked to input the contract address, network, and an ABI that you want to query. This will generate a new folder on your local machine with some basic code to start working on your subgraph. You can then finalize your subgraph to make sure it works as expected. | ||
|
||
## Graph Auth | ||
|
||
Before you can deploy your subgraph to Subgraph Studio, you need to login into your account within the CLI. To do this, you will need your deploy key, which you can find under your subgraph details page. | ||
|
||
Then, use the following command to authenticate from the CLI: | ||
|
||
```bash | ||
graph auth --studio <DEPLOY KEY> | ||
``` | ||
|
||
## Deploying a Subgraph | ||
|
||
Once you are ready, you can deploy your subgraph to Subgraph Studio. | ||
|
||
> Deploying a subgraph with the CLI pushes it to the Studio, where you can test it and and update the metadata. This action won't publish your subgraph to the decentralized network. | ||
Use the following CLI command to deploy your subgraph: | ||
|
||
```bash | ||
graph deploy --studio <SUBGRAPH_SLUG> | ||
``` | ||
|
||
After running this command, the CLI will ask for a version label. | ||
|
||
- It's strongly recommended to use [semver](https://semver.org/) for versioning like `0.0.1`. That said, you are free to choose any string as version such as `v1`, `version1`, or `asdf`. | ||
- The labels you create will be visible in Graph Explorer and can be used by curators to decide if they want to signal on a specific version or not, so choose them wisely. | ||
|
||
## Testing Your Subgraph | ||
|
||
After deploying, you can test your subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready. | ||
|
||
Use Subgraph Studio to check the logs on the dashboard and look for any errors with your subgraph. | ||
|
||
## Publish Your Subgraph | ||
|
||
In order to publish your subgraph successfully, review [publishing a subgraph](/publishing/publishing-a-subgraph/). | ||
|
||
## Versioning Your Subgraph with the CLI | ||
|
||
If you want to update your subgraph, you can do the following: | ||
|
||
- You can deploy a new version to Studio using the CLI (it will only be private at this point). | ||
- Once you're happy with it, you can publish your new deployment to [Graph Explorer](https://thegraph.com/explorer). | ||
- This action will create a new version of your subgraph that Curators can start signaling on and Indexers can index. | ||
|
||
You can also update your subgraph's metadata without publishing a new version. You can update your subgraph details in Studio (under the profile picture, name, description, etc.) by checking an option called **Update Details** in Graph Explorer. If this is checked, an on-chain transaction will be generated that updates subgraph details in Explorer without having to publish a new version with a new deployment. | ||
|
||
> Note: There are costs associated with publishing a new version of a subgraph to the network. In addition to the transaction fees, you must also fund a part of the curation tax on the auto-migrating signal. You cannot publish a new version of your subgraph if Curators have not signaled on it. For more information, please read more [here](/network/curating/). | ||
## Automatic Archiving of Subgraph Versions | ||
|
||
Whenever you deploy a new subgraph version in Subgraph Studio, the previous version will be archived. Archived versions won't be indexed/synced and therefore cannot be queried. You can unarchive an archived version of your subgraph in Subgraph Studio. | ||
|
||
> Note: Previous versions of non-published subgraphs deployed to Studio will be automatically archived. | ||
 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.