Skip to content

Commit 0acfeaf

Browse files
idalithbbenface
andauthored
Revert "Revert "Deploy subgraph" (#797)" (#810)
* Revert "Revert "Deploy subgraph" (#797)" This reverts commit b22ab57. * Update nginx.conf Co-authored-by: Benoît Rouleau <[email protected]> --------- Co-authored-by: Benoît Rouleau <[email protected]>
1 parent 8d3541b commit 0acfeaf

29 files changed

+3338
-227
lines changed

nginx.conf

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ http {
9292
rewrite ^/docs/([a-zA-Z][a-zA-Z])/developing/assemblyscript-api/$ $scheme://$http_host/docs/$1/developing/graph-ts/api/ permanent;
9393
rewrite ^/docs/en/substreams/(?!index\.).+$ https://substreams.streamingfast.io permanent;
9494
rewrite ^/docs/en/firehose/(?!index\.).+$ https://firehose.streamingfast.io permanent;
95+
rewrite ^/docs/([a-zA-Z][a-zA-Z])/deploying/deploying-a-subgraph-to-studio/$ $scheme://$http_host/docs/$1/deploying/deploy-using-subgraph-studio/ permanent;
96+
rewrite ^/docs/([a-zA-Z][a-zA-Z])/deploying/subgraph-studio/$ $scheme://$http_host/docs/$1/deploying/deploy-using-subgraph-studio/ permanent;
97+
9598
# Temporary redirects (302)
9699
rewrite ^/docs/en/querying/graph-client/$ $scheme://$http_host/docs/en/querying/graph-client/README/ redirect;
97100
rewrite ^/docs/en/developing/graph-ts/$ $scheme://$http_host/docs/en/developing/graph-ts/README/ redirect;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
title: Deploy Using Subgraph Studio
3+
---
4+
5+
Learn how to deploy your subgraph to Subgraph Studio.
6+
7+
> 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.
8+
9+
## Subgraph Studio Overview
10+
11+
In [Subgraph Studio](https://thegraph.com/studio/), you can do the following:
12+
13+
- View a list of subgraphs you've created
14+
- Manage, view details, and visualize the status of a specific subgraph
15+
- Create and manage your API keys for specific subgraphs
16+
- Restrict your API keys to specific domains and allow only certain Indexers to query with them
17+
- Create a new subgraph
18+
- Deploy your subgraph using The Graph CLI
19+
- Test your subgraph in the playground environment
20+
- Integrate your subgraph in staging using the development query URL
21+
- Publish your subgraph to The Graph Network
22+
- Manage your billing
23+
24+
## Install The Graph CLI
25+
26+
Before deploying, you must install The Graph CLI.
27+
28+
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.
29+
30+
**Install with yarn:**
31+
32+
```bash
33+
yarn global add @graphprotocol/graph-cli
34+
```
35+
36+
**Install with npm:**
37+
38+
```bash
39+
npm install -g @graphprotocol/graph-cli
40+
```
41+
42+
## Create Your Subgraph
43+
44+
Before deploying your subgraph you need to create an account in [Subgraph Studio](https://thegraph.com/studio/).
45+
46+
1. Open [Subgraph Studio](https://thegraph.com/studio/).
47+
2. Connect your wallet to sign in.
48+
- You can do this via MetaMask, Coinbase Wallet, WalletConnect, or Safe.
49+
3. After you sign in, your unique deploy key will be displayed on your subgraph details page.
50+
- 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.
51+
52+
> Important: You need an API key to query subgraphs.
53+
54+
### How to Create a Subgraph in Subgraph Studio
55+
56+
<VideoEmbed youtube="nGIFuC69bSA" />
57+
58+
> For additional written detail, review the [Quick-Start](/quick-start/).
59+
60+
### Subgraph Compatibility with The Graph Network
61+
62+
In order to be supported by Indexers on The Graph Network, subgraphs must:
63+
64+
- Index a [supported network](/developing/supported-networks)
65+
- Must not use any of the following features:
66+
- ipfs.cat & ipfs.map
67+
- Non-fatal errors
68+
- Grafting
69+
70+
## Initialize Your Subgraph
71+
72+
Once your subgraph has been created in Subgraph Studio, you can initialize its code through the CLI using this command:
73+
74+
```bash
75+
graph init --studio <SUBGRAPH_SLUG>
76+
```
77+
78+
You can find the `<SUBGRAPH_SLUG>` value on your subgraph details page in Subgraph Studio, see image below:
79+
80+
![Subgraph Studio - Slug](/img/doc-subgraph-slug.png)
81+
82+
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.
83+
84+
## Graph Auth
85+
86+
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.
87+
88+
Then, use the following command to authenticate from the CLI:
89+
90+
```bash
91+
graph auth --studio <DEPLOY KEY>
92+
```
93+
94+
## Deploying a Subgraph
95+
96+
Once you are ready, you can deploy your subgraph to Subgraph Studio.
97+
98+
> 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.
99+
100+
Use the following CLI command to deploy your subgraph:
101+
102+
```bash
103+
graph deploy --studio <SUBGRAPH_SLUG>
104+
```
105+
106+
After running this command, the CLI will ask for a version label.
107+
108+
- 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`.
109+
- 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.
110+
111+
## Testing Your Subgraph
112+
113+
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.
114+
115+
Use Subgraph Studio to check the logs on the dashboard and look for any errors with your subgraph.
116+
117+
## Publish Your Subgraph
118+
119+
In order to publish your subgraph successfully, review [publishing a subgraph](/publishing/publishing-a-subgraph/).
120+
121+
## Versioning Your Subgraph with the CLI
122+
123+
If you want to update your subgraph, you can do the following:
124+
125+
- You can deploy a new version to Studio using the CLI (it will only be private at this point).
126+
- Once you're happy with it, you can publish your new deployment to [Graph Explorer](https://thegraph.com/explorer).
127+
- This action will create a new version of your subgraph that Curators can start signaling on and Indexers can index.
128+
129+
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.
130+
131+
> 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/).
132+
133+
## Automatic Archiving of Subgraph Versions
134+
135+
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.
136+
137+
> Note: Previous versions of non-published subgraphs deployed to Studio will be automatically archived.
138+
139+
![Subgraph Studio - Unarchive](/img/Unarchive.png)

website/pages/ar/deploying/deploying-a-subgraph-to-studio.mdx

-68
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
title: Deploy Using Subgraph Studio
3+
---
4+
5+
Learn how to deploy your subgraph to Subgraph Studio.
6+
7+
> 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.
8+
9+
## Subgraph Studio Overview
10+
11+
In [Subgraph Studio](https://thegraph.com/studio/), you can do the following:
12+
13+
- View a list of subgraphs you've created
14+
- Manage, view details, and visualize the status of a specific subgraph
15+
- Create and manage your API keys for specific subgraphs
16+
- Restrict your API keys to specific domains and allow only certain Indexers to query with them
17+
- Create your subgraph through the Studio UI
18+
- Deploy your subgraph using the The Graph CLI
19+
- Test your subgraph in the playground environment
20+
- Integrate your subgraph in staging using the development query URL
21+
- Publish your subgraph with the Studio UI
22+
- Manage your billing
23+
24+
## Install The Graph CLI
25+
26+
Before deploying, you must install The Graph CLI.
27+
28+
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.
29+
30+
**Install with yarn:**
31+
32+
```bash
33+
yarn global add @graphprotocol/graph-cli
34+
```
35+
36+
**Install with npm:**
37+
38+
```bash
39+
npm install -g @graphprotocol/graph-cli
40+
```
41+
42+
## Create Your Subgraph
43+
44+
Before deploying your subgraph you need to create an account in [Subgraph Studio](https://thegraph.com/studio/).
45+
46+
1. Open [Subgraph Studio](https://thegraph.com/studio/).
47+
2. Connect your wallet to sign in.
48+
- You can do this via MetaMask, Coinbase Wallet, WalletConnect, or Safe.
49+
3. After you sign in, your unique deploy key will be displayed on your subgraph details page.
50+
- 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.
51+
52+
> Important: You need an API key to query subgraphs
53+
54+
### How to Create a Subgraph in Subgraph Studio
55+
56+
<VideoEmbed youtube="nGIFuC69bSA" />
57+
58+
> For additional written detail, review the [Quick-Start](/quick-start/).
59+
60+
### Subgraph Compatibility with The Graph Network
61+
62+
In order to be supported by Indexers on The Graph Network, subgraphs must:
63+
64+
- Index a [supported network](/developing/supported-networks)
65+
- Must not use any of the following features:
66+
- ipfs.cat & ipfs.map
67+
- Non-fatal errors
68+
- Grafting
69+
70+
## Initialize Your Subgraph
71+
72+
Once your subgraph has been created in Subgraph Studio, you can initialize its code through the CLI using this command:
73+
74+
```bash
75+
graph init --studio <SUBGRAPH_SLUG>
76+
```
77+
78+
You can find the `<SUBGRAPH_SLUG>` value on your subgraph details page in Subgraph Studio, see image below:
79+
80+
![Subgraph Studio - Slug](/img/doc-subgraph-slug.png)
81+
82+
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.
83+
84+
## Graph Auth
85+
86+
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.
87+
88+
Then, use the following command to authenticate from the CLI:
89+
90+
```bash
91+
graph auth --studio <DEPLOY KEY>
92+
```
93+
94+
## Deploying a Subgraph
95+
96+
Once you are ready, you can deploy your subgraph to Subgraph Studio.
97+
98+
> 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.
99+
100+
Use the following CLI command to deploy your subgraph:
101+
102+
```bash
103+
graph deploy --studio <SUBGRAPH_SLUG>
104+
```
105+
106+
After running this command, the CLI will ask for a version label.
107+
108+
- 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`.
109+
- 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.
110+
111+
## Testing Your Subgraph
112+
113+
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.
114+
115+
Use Subgraph Studio to check the logs on the dashboard and look for any errors with your subgraph.
116+
117+
## Publish Your Subgraph
118+
119+
In order to publish your subgraph successfully, review [publishing a subgraph](/publishing/publishing-a-subgraph/).
120+
121+
## Versioning Your Subgraph with the CLI
122+
123+
If you want to update your subgraph, you can do the following:
124+
125+
- You can deploy a new version to Studio using the CLI (it will only be private at this point).
126+
- Once you're happy with it, you can publish your new deployment to [Graph Explorer](https://thegraph.com/explorer).
127+
- This action will create a new version of your subgraph that Curators can start signaling on and Indexers can index.
128+
129+
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.
130+
131+
> 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/).
132+
133+
## Automatic Archiving of Subgraph Versions
134+
135+
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.
136+
137+
> Note: Previous versions of non-published subgraphs deployed to Studio will be automatically archived.
138+
139+
![Subgraph Studio - Unarchive](/img/Unarchive.png)

0 commit comments

Comments
 (0)