Enable debug logs in graph-node and update instructions

This commit is contained in:
Prathamesh Musale 2023-08-22 14:20:38 +05:30
parent 9b9eb573fa
commit 832afec06a
3 changed files with 55 additions and 69 deletions

View File

@ -20,7 +20,7 @@ services:
# TODO: Get endpoint from env
# ethereum: 'lotus-fixturenet:http://lotus-node-1:1234/rpc/v1'
ethereum: 'filecoin:https://archive.lotus.vdb.to/rpc/v1'
GRAPH_LOG: info
GRAPH_LOG: debug
ports:
- "8000"
- "8001"

View File

@ -12,13 +12,13 @@ services:
- APP=v3
# - NETWORK=lotus-fixturenet
- NETWORK=filecoin
command: ["bash", "-c", "./v3/run-v3.sh && ./blocks/run-blocks.sh"]
command: ["bash", "-c", "./blocks/run-blocks.sh && ./v3/run-v3.sh"]
working_dir: /app/subgraphs
volumes:
- ../config/sushiswap-subgraph-v3/filecoin.js:/app/config/filecoin.js
# - ../config/sushiswap-subgraph-v3/lotus-fixturenet.js.template:/app/config/lotus-fixturenet.js.template
- ../config/sushiswap-subgraph-v3/run-v3.sh:/app/subgraphs/v3/run-v3.sh
- ../config/sushiswap-subgraph-v3/run-blocks.sh:/app/subgraphs/blocks/run-blocks.sh
- ../config/sushiswap-subgraph-v3/run-v3.sh:/app/subgraphs/v3/run-v3.sh
# - sushiswap_core_deployment:/app/subgraphs/v3/core-deployments/docker
# - sushiswap_periphery_deployment:/app/subgraphs/v3/deployments/docker
extra_hosts:

View File

@ -5,7 +5,7 @@
Clone required repositories:
```bash
laconic-so --stack sushiswap-subgraph setup-repositories
laconic-so --stack sushiswap-subgraph setup-repositories --pull
```
Checkout to a non-default branch in the cloned repos if required:
@ -16,7 +16,12 @@ cd ~/cerc
# Example
cd graph-node
git checkout <your-branch>
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:
@ -31,70 +36,57 @@ Deploy the stack:
```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph up
# Note: Remove any existing volumes for the cluster for a fresh start
```
After all services have started, wait and check that the subgraph has been deployed to graph-node
After all services have started:
* Follow `graph-node` logs:
```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph logs -f graph-node
```
* Check that the subgraphs have been deployed:
```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph 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 to for querying:
```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph logs -f sushiswap-subgraph-v3
# Find out the mapped host port for the subgraph endpoint
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph port graph-node 8000
# 0.0.0.0:HOST_PORT
# Expected end 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/v3-lotus/graphql
# 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-lotus
# sushigraph-sushiswap-subgraph-v3-1 |
# sushigraph-sushiswap-subgraph-v3-1 | Done
```
# Blocks subgraph endpoint:
http://127.0.0.1:<HOST_PORT>/subgraphs/name/sushiswap/blocks/graphql
## Run
To check graph-node logs:
```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph logs -f graph-node
```
To deploy tokens run:
```bash
docker exec -it sushigraph-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
```
This can be run multiple times to deploy ERC20 tokens
Take note of the deployed token addresses to use later
Get contract address of factory deployed:
```bash
docker exec -it sushigraph-sushiswap-v3-core-1 jq -r '.address' /app/deployments/docker/UniswapV3Factory.json
```
Set it to environment variable `FACTORY_ADDRESS` to use later
To create a pool:
```bash
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:create:docker --factory $FACTORY_ADDRESS --token0 $TOKEN1_ADDRESS --token1 $TOKEN2_ADDRESS --fee 500
```
Set the created pool address to environment variable `POOL_ADDRESS` to use later
To initialize pool:
```bash
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:initialize:docker --sqrt-price 4295128939 --pool $POOL_ADDRESS
```
Set the recipient address to the contract deployer:
```bash
export RECIPIENT=0xD375B03bd3A2434A9f675bEC4Ccd68aC5e67C743
```
Trigger pool mint event:
```bash
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:mint:docker --pool $POOL_ADDRESS --recipient $RECIPIENT --amount 10
```
Trigger pool burn event:
```bash
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:burn:docker --pool $POOL_ADDRESS --amount 10
# v3 subgraph endpoint:
http://127.0.0.1:<HOST_PORT>/subgraphs/name/sushiswap/v3-filecoin/graphql
```
## Clean up
@ -113,10 +105,4 @@ docker volume ls -q --filter "name=sushigraph"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=sushigraph")
# WARNING: After removing volumes with Lotus params
# They will be downloaded again on restart
# To remove volumes that do not contain Lotus params
docker volume rm $(docker volume ls -q --filter "name=sushigraph" | grep -v "params$")
```