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
+36-21Lines changed: 36 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,19 @@ title: Deploy Using Subgraph Studio
4
4
5
5
Learn how to deploy your subgraph in Subgraph Studio.
6
6
7
-
> Note: 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.
7
+
> Note: 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're publishing it on-chain.
8
8
9
9
## Subgraph Studio Overview
10
10
11
11
In [Subgraph Studio](https://thegraph.com/studio/), you can do the following:
12
12
13
13
- Create and manage your API keys for specific subgraphs
14
-
- Create your subgraph
15
-
-Authenticate your account from the CLI
16
-
-Deploy your subgraph
14
+
- Create your subgraph through Studio UI
15
+
-Deploy your subgraph using the CLI
16
+
-Publish your subgraph with the Studio UI
17
17
- Stage your subgraph in the playground environment
18
18
- Integrate your subgraph in staging using the query URL
19
+
- Restrict your API keys to specific domains and allow only certain Indexers to query with them
19
20
20
21
In [Subgraph Studio](https://thegraph.com/studio/), you can view the following:
21
22
@@ -43,23 +44,21 @@ yarn global add @graphprotocol/graph-cli
43
44
npm install -g @graphprotocol/graph-cli
44
45
```
45
46
46
-
## Create your subgraph
47
+
## Create your Subgraph
47
48
48
-
### Create an account
49
+
### Create an Account
49
50
50
51
Before deploying your subgraph you need to create a subgraph in [Subgraph Studio](https://thegraph.com/studio/).
51
52
52
53
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.
54
+
2. Connect your wallet to sign in.
55
+
- You can do this via MetaMask, Coinbase Wallet, WalletConnect, or Safe.
56
+
3. After you sign in, your unique deploy key will be displayed on your account home page.
56
57
- 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
58
60
59
> Important: You need API keys to query subgraphs
61
60
62
-
#### How to create a subgraph in Subgraph Studio
61
+
#### How to Create a Subgraph in Subgraph Studio
63
62
64
63
<VideoEmbedyoutube="nGIFuC69bSA" />
65
64
@@ -75,31 +74,31 @@ In order to be supported by Indexers on The Graph Network, subgraphs must:
75
74
- Non-fatal errors
76
75
- Grafting
77
76
78
-
## Initialize your subgraph
77
+
## Initialize your Subgraph
79
78
80
-
Once your subgraph has been created in Subgraph Studio you can initialize the subgraph code using this command:
79
+
Once your subgraph has been created in Subgraph Studio, you can initialize the subgraph code through the CLI using this command:
81
80
82
81
```bash
83
82
graph init --studio <SUBGRAPH_SLUG>
84
83
```
85
84
86
-
You can view the `<SUBGRAPH_SLUG>` value on your subgraph details page in Subgraph Studio, see image below:
85
+
You can find the `<SUBGRAPH_SLUG>` value on your subgraph details page in Subgraph Studio, see image below:
87
86
88
87

89
88
90
89
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.
91
90
92
91
## Graph Auth
93
92
94
-
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, which you can find on your "My Subgraphs" page or under your subgraph details page.
93
+
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 on your "My Subgraphs" page or under your subgraph details page.
95
94
96
95
Then, use the following command to authenticate from the CLI:
97
96
98
97
```bash
99
98
graph auth --studio <DEPLOY KEY>
100
99
```
101
100
102
-
## Deploying a subgraph
101
+
## Deploying a Subgraph
103
102
104
103
Once you are ready, you can deploy your subgraph to Subgraph Studio.
105
104
@@ -116,14 +115,30 @@ After running this command, the CLI will ask for a version label.
116
115
- 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`.
117
116
- 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.
118
117
119
-
## Testing your subgraph
118
+
## Testing your Subgraph
120
119
121
120
After deploying, you can test/stage your subgraph in Subgraph Studio, deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready.
122
121
123
122
Use Subgraph Studio’s playground to check your subgraph logs and see where a subgraph fails.
124
123
125
-
## Publish your subgraph
126
-
127
-
You are now ready to publish your subgraph!
124
+
## Publish your Subgraph
128
125
129
126
In order to publish your subgraph successfully, review [publishing a subgraph](/publishing/publishing-a-subgraph/).
127
+
128
+
## Versioning your Subgraph with the CLI
129
+
130
+
If you want to update your subgraph, you can do the following:
131
+
132
+
- You can deploy a new version to the Studio using the CLI (it will only be private at this point).
133
+
- Once you're happy with it, you can publish your new deployment to [Graph Explorer](https://thegraph.com/explorer).
134
+
- This action will create a new version of your subgraph that curators can start signaling on and Indexers can index.
135
+
136
+
You can also update your subgraphs' metadata without publishing a new version. You can update your subgraph details in the 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 the Explorer without having to publish a new version with a new deployment.
137
+
138
+
> 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 on the risks of curation, please read more [here](/network/curating/).
139
+
140
+
## Automatic Archiving of Subgraph Versions
141
+
142
+
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 the Studio UI.
143
+
144
+
> Note: Previous versions of non-published subgraphs deployed to the Studio will be automatically archived.
0 commit comments