From 117d67a135bad82656aeb79e90dc05a9b614f775 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 14 Jun 2024 11:13:32 +0530 Subject: [PATCH] Add v2 watcher stack instructions --- .../cerc-watcher-sushiswap/.dockerignore | 2 +- .../cerc-watcher-sushiswap/Dockerfile | 2 +- .../cerc-watcher-sushiswap/build.sh | 2 +- .../stacks/sushiswap-v2/README.md | 104 ++++++++++++++++++ .../stacks/sushiswap-v2/stack.yml | 8 ++ .../stacks/sushiswap-v3/README.md | 4 +- 6 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 stacks/stack-orchestrator/stacks/sushiswap-v2/README.md create mode 100644 stacks/stack-orchestrator/stacks/sushiswap-v2/stack.yml diff --git a/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/.dockerignore b/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/.dockerignore index 59da4af..6013216 100644 --- a/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/.dockerignore +++ b/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/.dockerignore @@ -1 +1 @@ -stacks \ No newline at end of file +stacks diff --git a/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/Dockerfile b/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/Dockerfile index 62e580a..6c16543 100644 --- a/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/Dockerfile +++ b/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/Dockerfile @@ -11,5 +11,5 @@ RUN COMMIT_HASH=$(git rev-parse HEAD) && \ jq --arg commitHash "$COMMIT_HASH" '.commitHash = $commitHash' package.json > tmp.json && \ mv tmp.json package.json -RUN echo "Installing dependencies and building sushiswap-v3-watcher-ts" && \ +RUN echo "Installing dependencies and building sushiswap-watcher-ts" && \ yarn && yarn build diff --git a/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/build.sh b/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/build.sh index cff4cd9..2bdc814 100755 --- a/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/build.sh +++ b/stacks/stack-orchestrator/container-build/cerc-watcher-sushiswap/build.sh @@ -4,4 +4,4 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -docker build -t cerc/watcher-sushiswap:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/sushiswap-watcher-ts \ No newline at end of file +docker build -t cerc/watcher-sushiswap:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/sushiswap-watcher-ts diff --git a/stacks/stack-orchestrator/stacks/sushiswap-v2/README.md b/stacks/stack-orchestrator/stacks/sushiswap-v2/README.md new file mode 100644 index 0000000..93c58e1 --- /dev/null +++ b/stacks/stack-orchestrator/stacks/sushiswap-v2/README.md @@ -0,0 +1,104 @@ +# SushiSwap v2 Watcher + +## Clone the stack repo + +```bash +laconic-so fetch-stack git.vdb.to/deep-stack/sushiswap-watcher-ts +``` + +## Build the container image + +```bash +laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v2 build-containers +``` + +## Create a spec file for the deployment + +```bash +laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v2 deploy init --output sushiswap-v2-spec.yml +``` + +### Ports + +Edit `network` in the spec file to map container ports to host ports as required: + +```yml +... +network: + ports: + sushiswap-v2-watcher-db: + - 15432:5432 + sushiswap-v2-watcher-job-runner: + - 9000:9000 + sushiswap-v2-watcher-server: + - 3008:3008 + - 9001:9001 +``` + +## Create a deployment from the spec file + +```bash +laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v2 deploy create --spec-file sushiswap-v2-spec.yml --deployment-dir sushiswap-v2-deployment +``` + +### Configuration + +Inside deployment directory, open the `config.env` file and set following env variables: + +```bash +# External Filecoin (ETH RPC) endpoint to point the watcher to +CERC_ETH_RPC_ENDPOINTS=https://example-lotus-endpoint-1/rpc/v1,https://example-lotus-endpoint-2/rpc/v1 +``` + +## Start the deployment + +```bash +laconic-so deployment --dir sushiswap-v2-deployment start +``` + +* To list down and monitor the running containers: + + ```bash + # With status + docker ps -a + + # Check logs for a container + docker logs -f + ``` + +* Open the GQL playground at + + ```graphql + # Example query + query { + _meta { + block { + hash + number + timestamp + } + deployment + hasIndexingErrors + } + ``` + +## Clean up + +Stop all the sushiswap-v2 services running in background: + +```bash +# Only stop the docker containers +laconic-so deployment --dir sushiswap-v2-deployment stop + +# Run 'start' to restart the deployment +``` + +To stop all the sushiswap-v2 services and also delete data: + +```bash +# Stop the docker containers +laconic-so deployment --dir sushiswap-v2-deployment stop --delete-volumes + +# Remove deployment directory (deployment will have to be recreated for a re-run) +rm -r sushiswap-v2-deployment +``` diff --git a/stacks/stack-orchestrator/stacks/sushiswap-v2/stack.yml b/stacks/stack-orchestrator/stacks/sushiswap-v2/stack.yml new file mode 100644 index 0000000..8ed7246 --- /dev/null +++ b/stacks/stack-orchestrator/stacks/sushiswap-v2/stack.yml @@ -0,0 +1,8 @@ +version: "1.0" +name: sushiswap-v2 +description: "SushiSwap v2 watcher stack" +repos: +containers: + - cerc/watcher-sushiswap +pods: + - watcher-sushiswap-v2 diff --git a/stacks/stack-orchestrator/stacks/sushiswap-v3/README.md b/stacks/stack-orchestrator/stacks/sushiswap-v3/README.md index 2fd02ce..392a49c 100644 --- a/stacks/stack-orchestrator/stacks/sushiswap-v3/README.md +++ b/stacks/stack-orchestrator/stacks/sushiswap-v3/README.md @@ -3,7 +3,7 @@ ## Clone the stack repo ```bash -laconic-so fetch-stack ~/cerc/sushiswap-watcher-ts/stack-orchestrator/stacks/sushiswap-v3 +laconic-so fetch-stack git.vdb.to/deep-stack/sushiswap-watcher-ts ``` ## Build the container image @@ -101,4 +101,4 @@ laconic-so deployment --dir sushiswap-v3-deployment stop --delete-volumes # Remove deployment directory (deployment will have to be recreated for a re-run) rm -r sushiswap-v3-deployment -``` \ No newline at end of file +```