From 5fb8c3db8c2f56faf5af01b358e026a1c5815340 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Mon, 14 Aug 2023 13:05:13 +0530 Subject: [PATCH] Fixes to deploy sushiswap subgraph to graph-node --- .../docker-compose-contract-sushiswap.yml | 2 ++ .../docker-compose-fixturenet-graph-node.yml | 2 +- .../docker-compose-fixturenet-lotus.yml | 4 ++-- .../docker-compose-sushiswap-subgraph-v3.yml | 7 +++--- ...urenet.js => lotus-fixturenet.js.template} | 0 .../config/sushiswap-subgraph-v3/run-v3.sh | 14 ++++++------ .../Dockerfile | 0 .../build.sh | 0 app/data/stacks/sushiswap-subgraph/README.md | 22 +++++++++++++++++++ app/data/stacks/sushiswap-subgraph/stack.yml | 2 ++ 10 files changed, 40 insertions(+), 13 deletions(-) rename app/data/config/sushiswap-subgraph-v3/{lotus-fixturenet.js => lotus-fixturenet.js.template} (100%) mode change 100644 => 100755 app/data/config/sushiswap-subgraph-v3/run-v3.sh rename app/data/container-build/{cerc-sushiswap-subgraph => cerc-sushiswap-subgraphs}/Dockerfile (100%) rename app/data/container-build/{cerc-sushiswap-subgraph => cerc-sushiswap-subgraphs}/build.sh (100%) diff --git a/app/data/compose/docker-compose-contract-sushiswap.yml b/app/data/compose/docker-compose-contract-sushiswap.yml index f6456f2a..96ee1a3e 100644 --- a/app/data/compose/docker-compose-contract-sushiswap.yml +++ b/app/data/compose/docker-compose-contract-sushiswap.yml @@ -4,6 +4,7 @@ services: # Deploys the core (UniswapV3Factory) contract sushiswap-v3-core: image: cerc/sushiswap-v3-core:local + restart: on-failure env_file: # Defaults - ../config/contract-sushiswap/deployment-params.env @@ -24,6 +25,7 @@ services: # Deploys the periphery (NFPM, token, etc.) contracts sushiswap-v3-periphery: image: cerc/sushiswap-v3-periphery:local + restart: on-failure env_file: # Defaults - ../config/contract-sushiswap/deployment-params.env diff --git a/app/data/compose/docker-compose-fixturenet-graph-node.yml b/app/data/compose/docker-compose-fixturenet-graph-node.yml index 8d66c491..eb47dc2b 100644 --- a/app/data/compose/docker-compose-fixturenet-graph-node.yml +++ b/app/data/compose/docker-compose-fixturenet-graph-node.yml @@ -26,7 +26,7 @@ services: - "8020" - "8030" healthcheck: - test: ["CMD", "nc", "-v", "localhost", "8020"] + test: ["CMD", "nc", "-vz", "localhost", "8020"] interval: 30s timeout: 10s retries: 10 diff --git a/app/data/compose/docker-compose-fixturenet-lotus.yml b/app/data/compose/docker-compose-fixturenet-lotus.yml index b04795f9..4eb27039 100644 --- a/app/data/compose/docker-compose-fixturenet-lotus.yml +++ b/app/data/compose/docker-compose-fixturenet-lotus.yml @@ -36,7 +36,7 @@ services: test: ["CMD", "nc", "-vz", "localhost", "1234"] interval: 30s timeout: 10s - retries: 10 + retries: 60 start_period: 3s depends_on: - lotus-miner @@ -64,7 +64,7 @@ services: test: ["CMD", "nc", "-vz", "localhost", "1234"] interval: 30s timeout: 10s - retries: 10 + retries: 60 start_period: 3s depends_on: - lotus-miner diff --git a/app/data/compose/docker-compose-sushiswap-subgraph-v3.yml b/app/data/compose/docker-compose-sushiswap-subgraph-v3.yml index d65ba601..b4a7b313 100644 --- a/app/data/compose/docker-compose-sushiswap-subgraph-v3.yml +++ b/app/data/compose/docker-compose-sushiswap-subgraph-v3.yml @@ -6,14 +6,15 @@ services: image: cerc/sushiswap-subgraphs:local restart: on-failure depends_on: - graph-node + graph-node: + condition: service_healthy environment: - APP=v3 - NETWORK=lotus-fixturenet - command: ["./run-v3.sh"] + command: ["bash", "-c", "./run-v3.sh"] working_dir: /app/subgraphs/v3 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 - sushiswap_core_deployment:/app/subgraphs/v3/core-deployments/docker - sushiswap_periphery_deployment:/app/subgraphs/v3/deployments/docker diff --git a/app/data/config/sushiswap-subgraph-v3/lotus-fixturenet.js b/app/data/config/sushiswap-subgraph-v3/lotus-fixturenet.js.template similarity index 100% rename from app/data/config/sushiswap-subgraph-v3/lotus-fixturenet.js rename to app/data/config/sushiswap-subgraph-v3/lotus-fixturenet.js.template diff --git a/app/data/config/sushiswap-subgraph-v3/run-v3.sh b/app/data/config/sushiswap-subgraph-v3/run-v3.sh old mode 100644 new mode 100755 index d1ede176..8ca01460 --- a/app/data/config/sushiswap-subgraph-v3/run-v3.sh +++ b/app/data/config/sushiswap-subgraph-v3/run-v3.sh @@ -4,19 +4,19 @@ set -e # Loop until the NFPM deployment is detected 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 done echo "Reading contract addresses and block numbers from deployments" -FACTORY_ADDRESS=$(jq -r '.address' /app/core-deployments/docker/UniswapV3Factory.json) -FACTORY_BLOCK=$(jq -r '.receipt.blockNumber' /app/core-deployments/docker/UniswapV3Factory.json) -NATIVE_ADDRESS=$(jq -r '.address' /app/deployments/docker/WFIL.json) -NFPM_ADDRESS=$(jq -r '.address' /app/deployments/docker/NonfungiblePositionManager.json) -NFPM_BLOCK=$(jq -r '.receipt.blockNumber' /app/deployments/docker/NonfungiblePositionManager.json) +FACTORY_ADDRESS=$(jq -r '.address' ./core-deployments/docker/UniswapV3Factory.json) +FACTORY_BLOCK=$(jq -r '.receipt.blockNumber' ./core-deployments/docker/UniswapV3Factory.json) +NATIVE_ADDRESS=$(jq -r '.address' ./deployments/docker/WFIL.json) +NFPM_ADDRESS=$(jq -r '.address' ./deployments/docker/NonfungiblePositionManager.json) +NFPM_BLOCK=$(jq -r '.receipt.blockNumber' ./deployments/docker/NonfungiblePositionManager.json) # Read the JavaScript file content -file_content=$(