stack-orchestrator/app/data/stacks/sushiswap-subgraph/README.md
prathamesh0 53ed18b3dc
Update sushiswap-subgraph stack to point to filecoin endpoint (#509)
* Update sushiswap-subgraph stack to point to filecoin endpoint

* Deploy blocks subgraph in sushiswap-subgraph stack

* Update subgraph config

* Remove duplicate nativePricePool

* Enable debug logs in graph-node and update instructions

* Two additional miner nodes in fixturenet-lotus

* Revert experimental change for additional miner nodes

* Set ETHEREUM_REORG_THRESHOLD env for graph-node to catch up to head

* Take ETH RPC endpoint for graph-node from env

* Set default values for RPC endpoint in graph-node

* Rename fixturenet-graph-node pod to graph-node

* Clean up sushiswap-subgraph stack

* Use deployment command in sushiswap-subgraph stack

* Add a separate fixturenet-sushiswap-subgraph stack

* Fix pods in fixturenet-sushiswap-subgraph

* Fix fixturenet subgraph deployment commands and instructions

---------

Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
2023-08-30 16:05:16 +05:30

129 lines
3.3 KiB
Markdown

# SushiSwap Subgraph
## Setup
Clone required repositories:
```bash
laconic-so --stack sushiswap-subgraph setup-repositories --pull
```
Checkout to a non-default branch in the cloned repos if required:
```bash
# Default repo base dir
cd ~/cerc
# Example
cd graph-node
git checkout <your-branch> && git pull
# Remove the corresponding docker image if it already exists
docker image rm cerc/graph-node:local
# Remove any dangling images
docker image prune
```
Build the container images:
```bash
laconic-so --stack sushiswap-subgraph build-containers
```
## Create a deployment
Initialize deployment and create "spec" file:
```bash
laconic-so --stack sushiswap-subgraph deploy init --output sushiswap-subgraph-spec.yml
```
We need to assign a fixed port `8000` for graph-node subgraph GQL endpoint. The values can be
customized by editing the "spec" file generated by `laconic-so deploy init`.
```
$ cat sushiswap-subgraph-spec.yml
stack: sushiswap-subgraph
ports:
graph-node:
- '8000:8000'
- '8001'
- '8020'
- '8030'
...
```
Create deployment:
```bash
laconic-so deploy create --spec-file sushiswap-subgraph-spec.yml --deployment-dir sushiswap-subgraph-deployment
```
## Start the stack
Deploy the stack:
```bash
laconic-so deployment --dir sushiswap-subgraph-deployment start
# Note: Remove any existing volumes for the cluster for a fresh start
```
After all services have started:
* Follow `graph-node` logs:
```bash
laconic-so deployment --dir sushiswap-subgraph-deployment logs -f graph-node
```
* Check that the subgraphs have been deployed:
```bash
laconic-so deployment --dir sushiswap-subgraph-deployment logs -f sushiswap-subgraph-v3
# Expected output:
# .
# .
# sushigraph-sushiswap-subgraph-v3-1 | - Deploying to Graph node http://graph-node:8020/
# sushigraph-sushiswap-subgraph-v3-1 | Deployed to http://graph-node:8000/subgraphs/name/sushiswap/blocks/graphql
# sushigraph-sushiswap-subgraph-v3-1 |
# sushigraph-sushiswap-subgraph-v3-1 |
# sushigraph-sushiswap-subgraph-v3-1 | Subgraph endpoints:
# sushigraph-sushiswap-subgraph-v3-1 | Queries (HTTP): http://graph-node:8000/subgraphs/name/sushiswap/blocks
# .
# .
# sushigraph-sushiswap-subgraph-v3-1 | - Deploying to Graph node http://graph-node:8020/
# sushigraph-sushiswap-subgraph-v3-1 | Deployed to http://graph-node:8000/subgraphs/name/sushiswap/v3-filecoin/graphql
# sushigraph-sushiswap-subgraph-v3-1 |
# sushigraph-sushiswap-subgraph-v3-1 |
# sushigraph-sushiswap-subgraph-v3-1 | Subgraph endpoints:
# sushigraph-sushiswap-subgraph-v3-1 | Queries (HTTP): http://graph-node:8000/subgraphs/name/sushiswap/v3-filecoin
# sushigraph-sushiswap-subgraph-v3-1 |
# sushigraph-sushiswap-subgraph-v3-1 |
# sushigraph-sushiswap-subgraph-v3-1 | Done
```
After `graph-node` has fetched the latest blocks from upstream, use the subgraph (GQL) endpoints for querying:
```bash
# Blocks subgraph endpoint:
http://127.0.0.1:8000/subgraphs/name/sushiswap/blocks/graphql
# v3 subgraph endpoint:
http://127.0.0.1:8000/subgraphs/name/sushiswap/v3-filecoin/graphql
```
## Clean up
Stop all the services running in background run:
```bash
laconic-so deployment --dir sushiswap-subgraph-deployment stop
```
Clear volumes created by this stack:
```bash
laconic-so deployment --dir sushiswap-subgraph-deployment stop --delete-volumes
```