From b27dbbc1cab7e9afc1fe9dede79e4b63e6b03f59 Mon Sep 17 00:00:00 2001 From: neeraj Date: Wed, 22 Nov 2023 17:40:19 +0530 Subject: [PATCH] Update stack to run azimuth job runner --- .../docker-compose-watcher-azimuth.yml | 18 +++++++++++++ .../watcher-azimuth/start-job-runner.sh | 26 +++++++++++++++++++ .../watcher-config-template.toml | 1 + .../data/stacks/azimuth/README.md | 8 ------ .../data/stacks/azimuth/stack.yml | 2 +- 5 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 stack_orchestrator/data/config/watcher-azimuth/start-job-runner.sh diff --git a/stack_orchestrator/data/compose/docker-compose-watcher-azimuth.yml b/stack_orchestrator/data/compose/docker-compose-watcher-azimuth.yml index 327c77fc..b218908d 100644 --- a/stack_orchestrator/data/compose/docker-compose-watcher-azimuth.yml +++ b/stack_orchestrator/data/compose/docker-compose-watcher-azimuth.yml @@ -22,6 +22,24 @@ services: retries: 15 start_period: 10s + # Starts the azimuth-watcher job runner + azimuth-watcher-job-runner: + image: cerc/watcher-azimuth:local + restart: unless-stopped + depends_on: + watcher-db: + condition: service_healthy + environment: + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} + CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC} + CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL} + working_dir: /app/packages/azimuth-watcher + command: "./start-job-runner.sh" + volumes: + - ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/azimuth-watcher/environments/watcher-config-template.toml + - ../config/watcher-azimuth/merge-toml.js:/app/packages/azimuth-watcher/merge-toml.js + - ../config/watcher-azimuth/start-job-runner.sh:/app/packages/azimuth-watcher/start-job-runner.sh + # Starts the azimuth-watcher server azimuth-watcher-server: image: cerc/watcher-azimuth:local diff --git a/stack_orchestrator/data/config/watcher-azimuth/start-job-runner.sh b/stack_orchestrator/data/config/watcher-azimuth/start-job-runner.sh new file mode 100644 index 00000000..c0a6a94f --- /dev/null +++ b/stack_orchestrator/data/config/watcher-azimuth/start-job-runner.sh @@ -0,0 +1,26 @@ +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +echo "Using IPLD ETH RPC endpoint ${CERC_IPLD_ETH_RPC}" +echo "Using IPLD GQL endpoint ${CERC_IPLD_ETH_GQL}" + +# Replace env variables in template TOML file +# Read in the config template TOML file and modify it +WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml) +WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \ + sed -E "s|REPLACE_WITH_CERC_IPLD_ETH_RPC|${CERC_IPLD_ETH_RPC}|g; \ + s|REPLACE_WITH_CERC_IPLD_ETH_GQL|${CERC_IPLD_ETH_GQL}| ") + +# Write the modified content to a new file +echo "$WATCHER_CONFIG" > environments/watcher-config.toml + +# Merge SO watcher config with existing config file +node merge-toml.js + +echo 'yarn job-runner' + +yarn watch:contract --address 0x223c067F8CF28ae173EE5CafEa60cA44C335fecB --kind Azimuth --checkpoint true --starting-block 6784880 +yarn yarn job-runner + diff --git a/stack_orchestrator/data/config/watcher-azimuth/watcher-config-template.toml b/stack_orchestrator/data/config/watcher-azimuth/watcher-config-template.toml index 1a4616fc..512f6242 100644 --- a/stack_orchestrator/data/config/watcher-azimuth/watcher-config-template.toml +++ b/stack_orchestrator/data/config/watcher-azimuth/watcher-config-template.toml @@ -12,3 +12,4 @@ [upstream.ethServer] gqlApiEndpoint = "REPLACE_WITH_CERC_IPLD_ETH_GQL" rpcProviderEndpoint = "REPLACE_WITH_CERC_IPLD_ETH_RPC" + rpcClient = true \ No newline at end of file diff --git a/stack_orchestrator/data/stacks/azimuth/README.md b/stack_orchestrator/data/stacks/azimuth/README.md index 67f42b75..5782b068 100644 --- a/stack_orchestrator/data/stacks/azimuth/README.md +++ b/stack_orchestrator/data/stacks/azimuth/README.md @@ -15,14 +15,6 @@ laconic-so --stack azimuth setup-repositories NOTE: If the repository already exists and checked out to a different version, `setup-repositories` command will throw an error. For getting around this, the `azimuth-watcher-ts` repository can be removed and then run the command. -Checkout to the required versions and branches in repos - -```bash -# azimuth-watcher-ts -cd ~/cerc/azimuth-watcher-ts -git checkout v0.1.0 -``` - Build the container images: ```bash diff --git a/stack_orchestrator/data/stacks/azimuth/stack.yml b/stack_orchestrator/data/stacks/azimuth/stack.yml index 47e0d058..bb7f2a88 100644 --- a/stack_orchestrator/data/stacks/azimuth/stack.yml +++ b/stack_orchestrator/data/stacks/azimuth/stack.yml @@ -1,7 +1,7 @@ version: "1.0" name: azimuth repos: - - github.com/cerc-io/azimuth-watcher-ts@v0.1.1 + - github.com/cerc-io/azimuth-watcher-ts containers: - cerc/watcher-azimuth pods: