From dfa5c764815b7201efd2117f0e1975d3d2944390 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 14 Jun 2024 11:57:24 +0530 Subject: [PATCH] Add job runner and server scripts in common folder --- .../docker-compose-watcher-sushiswap-v2.yml | 6 ++--- .../docker-compose-watcher-sushiswap-v3.yml | 6 ++--- .../start-job-runner.sh | 0 .../start-server.sh | 0 .../watcher-sushiswap-v3/start-job-runner.sh | 24 ------------------- .../watcher-sushiswap-v3/start-server.sh | 24 ------------------- .../stacks/sushiswap-v2/README.md | 2 +- 7 files changed, 7 insertions(+), 55 deletions(-) rename stacks/stack-orchestrator/config/{watcher-sushiswap-v2 => common}/start-job-runner.sh (100%) rename stacks/stack-orchestrator/config/{watcher-sushiswap-v2 => common}/start-server.sh (100%) delete mode 100755 stacks/stack-orchestrator/config/watcher-sushiswap-v3/start-job-runner.sh delete mode 100755 stacks/stack-orchestrator/config/watcher-sushiswap-v3/start-server.sh diff --git a/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap-v2.yml b/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap-v2.yml index 05122e2..2762498 100644 --- a/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap-v2.yml +++ b/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap-v2.yml @@ -34,9 +34,9 @@ services: command: ["bash", "./start-job-runner.sh"] volumes: - ../config/watcher-sushiswap-v2/watcher-config-template.toml:/app/packages/v2-watcher/environments/watcher-config-template.toml - - ../config/watcher-sushiswap-v2/start-job-runner.sh:/app/packages/v2-watcher/start-job-runner.sh + - ../config/common/start-job-runner.sh:/app/packages/v2-watcher/start-job-runner.sh ports: - - "9000:9000" + - "9000" healthcheck: test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"] interval: 20s @@ -61,7 +61,7 @@ services: command: ["bash", "./start-server.sh"] volumes: - ../config/watcher-sushiswap-v2/watcher-config-template.toml:/app/packages/v2-watcher/environments/watcher-config-template.toml - - ../config/watcher-sushiswap-v2/start-server.sh:/app/packages/v2-watcher/start-server.sh + - ../config/common/start-server.sh:/app/packages/v2-watcher/start-server.sh - sushiswap_v2_watcher_gql_logs_data:/app/packages/v2-watcher/gql-logs ports: - "3008" diff --git a/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap-v3.yml b/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap-v3.yml index b1f99bf..a36cf94 100644 --- a/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap-v3.yml +++ b/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap-v3.yml @@ -34,9 +34,9 @@ services: command: ["bash", "./start-job-runner.sh"] volumes: - ../config/watcher-sushiswap-v3/watcher-config-template.toml:/app/packages/v3-watcher/environments/watcher-config-template.toml - - ../config/watcher-sushiswap-v3/start-job-runner.sh:/app/packages/v3-watcher/start-job-runner.sh + - ../config/common/start-job-runner.sh:/app/packages/v3-watcher/start-job-runner.sh ports: - - "9000:9000" + - "9000" healthcheck: test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"] interval: 20s @@ -61,7 +61,7 @@ services: command: ["bash", "./start-server.sh"] volumes: - ../config/watcher-sushiswap-v3/watcher-config-template.toml:/app/packages/v3-watcher/environments/watcher-config-template.toml - - ../config/watcher-sushiswap-v3/start-server.sh:/app/packages/v3-watcher/start-server.sh + - ../config/common/start-server.sh:/app/packages/v3-watcher/start-server.sh - sushiswap_v3_watcher_gql_logs_data:/app/packages/v3-watcher/gql-logs ports: - "3008" diff --git a/stacks/stack-orchestrator/config/watcher-sushiswap-v2/start-job-runner.sh b/stacks/stack-orchestrator/config/common/start-job-runner.sh similarity index 100% rename from stacks/stack-orchestrator/config/watcher-sushiswap-v2/start-job-runner.sh rename to stacks/stack-orchestrator/config/common/start-job-runner.sh diff --git a/stacks/stack-orchestrator/config/watcher-sushiswap-v2/start-server.sh b/stacks/stack-orchestrator/config/common/start-server.sh similarity index 100% rename from stacks/stack-orchestrator/config/watcher-sushiswap-v2/start-server.sh rename to stacks/stack-orchestrator/config/common/start-server.sh diff --git a/stacks/stack-orchestrator/config/watcher-sushiswap-v3/start-job-runner.sh b/stacks/stack-orchestrator/config/watcher-sushiswap-v3/start-job-runner.sh deleted file mode 100755 index 7a7a83b..0000000 --- a/stacks/stack-orchestrator/config/watcher-sushiswap-v3/start-job-runner.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -e -if [ -n "$CERC_SCRIPT_DEBUG" ]; then - set -x -fi -set -u - -echo "Using ETH RPC endpoints ${CERC_ETH_RPC_ENDPOINTS}" - -# Read in the config template TOML file and modify it -WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml) - -# Convert the comma-separated list in CERC_ETH_RPC_ENDPOINTS to a JSON array -RPC_ENDPOINTS_ARRAY=$(echo "$CERC_ETH_RPC_ENDPOINTS" | tr ',' '\n' | awk '{print "\"" $0 "\""}' | paste -sd, - | sed 's/^/[/; s/$/]/') - -WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \ - sed -E "s|REPLACE_WITH_CERC_ETH_RPC_ENDPOINTS|${RPC_ENDPOINTS_ARRAY}| ") - -# Write the modified content to a new file -echo "$WATCHER_CONFIG" > environments/local.toml - -echo "Running job-runner..." -DEBUG=vulcanize:* exec node --enable-source-maps dist/job-runner.js diff --git a/stacks/stack-orchestrator/config/watcher-sushiswap-v3/start-server.sh b/stacks/stack-orchestrator/config/watcher-sushiswap-v3/start-server.sh deleted file mode 100755 index 9aaa77e..0000000 --- a/stacks/stack-orchestrator/config/watcher-sushiswap-v3/start-server.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -e -if [ -n "$CERC_SCRIPT_DEBUG" ]; then - set -x -fi -set -u - -echo "Using ETH RPC endpoints ${CERC_ETH_RPC_ENDPOINTS}" - -# Read in the config template TOML file and modify it -WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml) - -# Convert the comma-separated list in CERC_ETH_RPC_ENDPOINTS to a JSON array -RPC_ENDPOINTS_ARRAY=$(echo "$CERC_ETH_RPC_ENDPOINTS" | tr ',' '\n' | awk '{print "\"" $0 "\""}' | paste -sd, - | sed 's/^/[/; s/$/]/') - -WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \ - sed -E "s|REPLACE_WITH_CERC_ETH_RPC_ENDPOINTS|${RPC_ENDPOINTS_ARRAY}| ") - -# Write the modified content to a new file -echo "$WATCHER_CONFIG" > environments/local.toml - -echo "Running server..." -DEBUG=vulcanize:* exec node --enable-source-maps dist/server.js diff --git a/stacks/stack-orchestrator/stacks/sushiswap-v2/README.md b/stacks/stack-orchestrator/stacks/sushiswap-v2/README.md index 93c58e1..c8acfdc 100644 --- a/stacks/stack-orchestrator/stacks/sushiswap-v2/README.md +++ b/stacks/stack-orchestrator/stacks/sushiswap-v2/README.md @@ -3,7 +3,7 @@ ## Clone the stack repo ```bash -laconic-so fetch-stack git.vdb.to/deep-stack/sushiswap-watcher-ts +laconic-so fetch-stack git.vdb.to/cerc-io/sushiswap-watcher-ts ``` ## Build the container image