Fixes to deploy sushiswap subgraph to graph-node

This commit is contained in:
Nabarun 2023-08-14 13:05:13 +05:30
parent 4f6c3529aa
commit 5fb8c3db8c
10 changed files with 40 additions and 13 deletions

View File

@ -4,6 +4,7 @@ services:
# Deploys the core (UniswapV3Factory) contract # Deploys the core (UniswapV3Factory) contract
sushiswap-v3-core: sushiswap-v3-core:
image: cerc/sushiswap-v3-core:local image: cerc/sushiswap-v3-core:local
restart: on-failure
env_file: env_file:
# Defaults # Defaults
- ../config/contract-sushiswap/deployment-params.env - ../config/contract-sushiswap/deployment-params.env
@ -24,6 +25,7 @@ services:
# Deploys the periphery (NFPM, token, etc.) contracts # Deploys the periphery (NFPM, token, etc.) contracts
sushiswap-v3-periphery: sushiswap-v3-periphery:
image: cerc/sushiswap-v3-periphery:local image: cerc/sushiswap-v3-periphery:local
restart: on-failure
env_file: env_file:
# Defaults # Defaults
- ../config/contract-sushiswap/deployment-params.env - ../config/contract-sushiswap/deployment-params.env

View File

@ -26,7 +26,7 @@ services:
- "8020" - "8020"
- "8030" - "8030"
healthcheck: healthcheck:
test: ["CMD", "nc", "-v", "localhost", "8020"] test: ["CMD", "nc", "-vz", "localhost", "8020"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 10 retries: 10

View File

@ -36,7 +36,7 @@ services:
test: ["CMD", "nc", "-vz", "localhost", "1234"] test: ["CMD", "nc", "-vz", "localhost", "1234"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 10 retries: 60
start_period: 3s start_period: 3s
depends_on: depends_on:
- lotus-miner - lotus-miner
@ -64,7 +64,7 @@ services:
test: ["CMD", "nc", "-vz", "localhost", "1234"] test: ["CMD", "nc", "-vz", "localhost", "1234"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 10 retries: 60
start_period: 3s start_period: 3s
depends_on: depends_on:
- lotus-miner - lotus-miner

View File

@ -6,14 +6,15 @@ services:
image: cerc/sushiswap-subgraphs:local image: cerc/sushiswap-subgraphs:local
restart: on-failure restart: on-failure
depends_on: depends_on:
graph-node graph-node:
condition: service_healthy
environment: environment:
- APP=v3 - APP=v3
- NETWORK=lotus-fixturenet - NETWORK=lotus-fixturenet
command: ["./run-v3.sh"] command: ["bash", "-c", "./run-v3.sh"]
working_dir: /app/subgraphs/v3 working_dir: /app/subgraphs/v3
volumes: volumes:
- ../config/sushiswap-subgraph-v3/lotus-fixturenet.js:/app/config/lotus-fixturenet.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-v3.sh:/app/subgraphs/v3/run-v3.sh
- sushiswap_core_deployment:/app/subgraphs/v3/core-deployments/docker - sushiswap_core_deployment:/app/subgraphs/v3/core-deployments/docker
- sushiswap_periphery_deployment:/app/subgraphs/v3/deployments/docker - sushiswap_periphery_deployment:/app/subgraphs/v3/deployments/docker

14
app/data/config/sushiswap-subgraph-v3/run-v3.sh Normal file → Executable file
View File

@ -4,19 +4,19 @@ set -e
# Loop until the NFPM deployment is detected # Loop until the NFPM deployment is detected
echo "Waiting for sushiswap-periphery deployments to occur" echo "Waiting for sushiswap-periphery deployments to occur"
while [ ! -f /app/deployments/docker/NonfungiblePositionManager.json ]; do while [ ! -f ./deployments/docker/NonfungiblePositionManager.json ]; do
sleep 5 sleep 5
done done
echo "Reading contract addresses and block numbers from deployments" echo "Reading contract addresses and block numbers from deployments"
FACTORY_ADDRESS=$(jq -r '.address' /app/core-deployments/docker/UniswapV3Factory.json) FACTORY_ADDRESS=$(jq -r '.address' ./core-deployments/docker/UniswapV3Factory.json)
FACTORY_BLOCK=$(jq -r '.receipt.blockNumber' /app/core-deployments/docker/UniswapV3Factory.json) FACTORY_BLOCK=$(jq -r '.receipt.blockNumber' ./core-deployments/docker/UniswapV3Factory.json)
NATIVE_ADDRESS=$(jq -r '.address' /app/deployments/docker/WFIL.json) NATIVE_ADDRESS=$(jq -r '.address' ./deployments/docker/WFIL.json)
NFPM_ADDRESS=$(jq -r '.address' /app/deployments/docker/NonfungiblePositionManager.json) NFPM_ADDRESS=$(jq -r '.address' ./deployments/docker/NonfungiblePositionManager.json)
NFPM_BLOCK=$(jq -r '.receipt.blockNumber' /app/deployments/docker/NonfungiblePositionManager.json) NFPM_BLOCK=$(jq -r '.receipt.blockNumber' ./deployments/docker/NonfungiblePositionManager.json)
# Read the JavaScript file content # Read the JavaScript file content
file_content=$(</app/config/lotus-fixturenet.js) file_content=$(</app/config/lotus-fixturenet.js.template)
# Replace uppercase words with environment variables # Replace uppercase words with environment variables
echo "Reading values in lotus-fixturenet config" echo "Reading values in lotus-fixturenet config"

View File

@ -22,6 +22,22 @@ Deploy the stack:
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph up laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph up
``` ```
After all services have started, wait and check that the subgraph has been deployed to graph-node
```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph logs -f sushiswap-subgraph-v3
# 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
```
## Clean up ## Clean up
Stop all the services running in background run: Stop all the services running in background run:
@ -38,4 +54,10 @@ docker volume ls -q --filter "name=sushigraph"
# Remove all the listed volumes # Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=sushigraph") 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$")
``` ```

View File

@ -17,6 +17,8 @@ containers:
## sushiswap contract deployment images ## sushiswap contract deployment images
- cerc/sushiswap-v3-core - cerc/sushiswap-v3-core
- cerc/sushiswap-v3-periphery - cerc/sushiswap-v3-periphery
## sushiswap subgraphs image
- cerc/sushiswap-subgraphs
pods: pods:
- fixturenet-lotus - fixturenet-lotus
- fixturenet-graph-node - fixturenet-graph-node