You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/pages/en/deploying/deploying-a-subgraph-to-studio.mdx
+82-14Lines changed: 82 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,34 @@
2
2
title: Deploying a Subgraph to Subgraph Studio
3
3
---
4
4
5
-
These are the steps to deploy your subgraph to Subgraph Studio:
5
+
> Before deploying, you must install The Graph CLI; please review [Creating a Subgraph]()
6
6
7
-
- Install The Graph CLI (with either yarn or npm)
7
+
When you deploy a subgraph, you push it to Subgraph Studio, where you'll be able to stage it. It's important to remember that deploying is not the same as publishing. When you publish a subgraph, you are publishing it on-chain.
8
+
9
+
## What can you do in Subgraph Studio?
10
+
11
+
[Subgraph Studio]() allows you to do the following:
12
+
13
+
- Create and manage your API keys for specific subgraphs
8
14
- Create your Subgraph in Subgraph Studio
9
15
- Authenticate your account from the CLI
10
-
- Deploying a Subgraph to Subgraph Studio
16
+
- Deploy a Subgraph to Subgraph Studio
17
+
- Stage it in the playground environment
18
+
- Integrate it in staging using the query URL
19
+
20
+
In Subgraph Studio, you can view the following:
11
21
12
-
## Installing Graph CLI
22
+
- Your user account controls
23
+
- A list of subgraphs you've created
24
+
- A section to manage your API keys
25
+
- A section to manage, view details, and visualize the status of a specific subgraph
26
+
- A section to manage your billing
13
27
14
-
There is a CLI to deploy subgraphs to [Subgraph Studio](https://thegraph.com/studio/). Here are the commands to install `graph-cli`. This can be done using npm or yarn.
28
+
Step-by-Step
29
+
30
+
## Install the Graph CLI
31
+
32
+
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.
Before deploying your actual subgraph you need to create a subgraph in [Subgraph Studio](https://thegraph.com/studio/). We recommend you read our [Studio documentation](/deploying/subgraph-studio) to learn more about this.
48
+
### Create an account
49
+
50
+
Before deploying your subgraph you need to create a subgraph in [Subgraph Studio](https://thegraph.com/studio/).
51
+
52
+
1. Open [Subgraph Studio](https://thegraph.com/studio/).
53
+
2. Connect your wallet.
54
+
- You can do this via MetaMask, WalletConnect, Coinbase Wallet, or Safe.
55
+
3. After you connect your wallet, your unique deploy key will be displayed on your "My Subgraphs" page or your “subgraph details” page in the Studio.
56
+
- 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.
57
+
4. You can create one or multiple API keys by clicking the API keys tab at the top of your homepage. See image below:
58
+
- You can limit API keys to a specific domain in the security section.
59
+
60
+
> Important: You need API keys to query subgraphs
61
+
62
+
#### How to create a subgraph in Subgraph Studio
63
+
64
+
<VideoEmbedyoutube="nGIFuC69bSA" />
65
+
66
+
> For additional written detail, review the [quick-start]()
67
+
68
+
#### Subgraph Compatibility with The Graph Network
69
+
70
+
In order to be supported by Indexers on The Graph Network, subgraphs must:
71
+
72
+
- Index a [supported network](/developing/supported-networks)
73
+
- Must not use any of the following features:
74
+
- ipfs.cat & ipfs.map
75
+
- Non-fatal errors
76
+
- Grafting
31
77
32
78
## Initialize your Subgraph
33
79
@@ -37,32 +83,54 @@ Once your subgraph has been created in Subgraph Studio you can initialize the su
37
83
graph init --studio <SUBGRAPH_SLUG>
38
84
```
39
85
40
-
The `<SUBGRAPH_SLUG>` value can be found on your subgraph details page in Subgraph Studio:
86
+
You can view the `<SUBGRAPH_SLUG>` value on your subgraph details page in Subgraph Studio, see image below:
41
87
42
88

43
89
44
-
After running `graph init`, you will be asked to input the contract address, network, and ABI that you want to query. Doing 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.
90
+
After running `graph init`, you will be asked to input the contract address, network, and ABI that you want to query.
91
+
92
+
- 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.
45
93
46
94
## Graph Auth
47
95
48
-
Before being able to 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 that you can find on your "My Subgraphs" page or your subgraph details page.
96
+
Before can deploy your subgraph to Subgraph Studio, you must login into your account using the CLI. To do this, you will need your deploy key (you can find it on your "My Subgraphs" page or under your subgraph details page).
49
97
50
-
Here is the command that you need to use to authenticate from the CLI:
98
+
Then, use the following command to authenticate from the CLI:
51
99
52
100
```bash
53
101
graph auth --studio <DEPLOY KEY>
54
102
```
55
103
56
104
## Deploying a Subgraph to Subgraph Studio
57
105
58
-
Once you are ready, you can deploy your subgraph to Subgraph Studio. Doing this won't publish your subgraph to the decentralized network, it will only deploy it to your Studio account where you will be able to test it and update the metadata.
106
+
Once you are ready, you can deploy your subgraph to Subgraph Studio.
59
107
60
-
Here is the CLI command that you need to use to deploy your subgraph.
108
+
> 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.
109
+
110
+
Use the following CLI command to deploy your subgraph:
61
111
62
112
```bash
63
113
graph deploy --studio <SUBGRAPH_SLUG>
64
114
```
65
115
66
-
After running this command, the CLI will ask for a version label, you can name it however you want, you can use labels such as `0.1` and `0.2` or use letters as well such as `uniswap-v2-0.1`. Those labels will be visible in Graph Explorer and can be used by curators to decide if they want to signal on this version or not, so choose them wisely.
116
+
After running this command, the CLI will ask for a version label.
117
+
118
+
- 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`, `asdf`.
119
+
- 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.
120
+
121
+
## Testing your Subgraph
122
+
123
+
After deploying, you can test/stage your subgraph in Subgraph Studio, deploy another version, update the metadata, and publish to Graph Explorer when you are ready.
124
+
125
+
Use Subgraph Studio’s playground to:
126
+
127
+
- Check your subgraph logs
128
+
- The subgraph logs will indicate if and where a subgraph fails.
129
+
130
+
## Publish your Subgraph in Subgraph Studio
131
+
132
+
You are now ready to publish your subgraph!
133
+
134
+
In order to publish your subgraph successfully, review [publishing a subgraph] (/publishing/publishing-a-subgraph/).
67
135
68
-
Once deployed, you can test your subgraph in Subgraph Studio using the playground, deploy another version if needed, update the metadata, and when you are ready, publish your subgraph to Graph Explorer.
0 commit comments