Add job runner and server scripts in common folder

This commit is contained in:
IshaVenikar 2024-06-14 11:57:24 +05:30
parent 039f696574
commit 4ae58dbd71
7 changed files with 7 additions and 55 deletions

View File

@ -34,9 +34,9 @@ services:
command: ["bash", "./start-job-runner.sh"] command: ["bash", "./start-job-runner.sh"]
volumes: volumes:
- ../config/watcher-sushiswap-v2/watcher-config-template.toml:/app/packages/v2-watcher/environments/watcher-config-template.toml - ../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: ports:
- "9000:9000" - "9000"
healthcheck: healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"] test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"]
interval: 20s interval: 20s
@ -61,7 +61,7 @@ services:
command: ["bash", "./start-server.sh"] command: ["bash", "./start-server.sh"]
volumes: volumes:
- ../config/watcher-sushiswap-v2/watcher-config-template.toml:/app/packages/v2-watcher/environments/watcher-config-template.toml - ../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 - sushiswap_v2_watcher_gql_logs_data:/app/packages/v2-watcher/gql-logs
ports: ports:
- "3008" - "3008"

View File

@ -34,9 +34,9 @@ services:
command: ["bash", "./start-job-runner.sh"] command: ["bash", "./start-job-runner.sh"]
volumes: volumes:
- ../config/watcher-sushiswap-v3/watcher-config-template.toml:/app/packages/v3-watcher/environments/watcher-config-template.toml - ../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: ports:
- "9000:9000" - "9000"
healthcheck: healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"] test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"]
interval: 20s interval: 20s
@ -61,7 +61,7 @@ services:
command: ["bash", "./start-server.sh"] command: ["bash", "./start-server.sh"]
volumes: volumes:
- ../config/watcher-sushiswap-v3/watcher-config-template.toml:/app/packages/v3-watcher/environments/watcher-config-template.toml - ../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 - sushiswap_v3_watcher_gql_logs_data:/app/packages/v3-watcher/gql-logs
ports: ports:
- "3008" - "3008"

View File

@ -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

View File

@ -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

View File

@ -3,7 +3,7 @@
## Clone the stack repo ## Clone the stack repo
```bash ```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 ## Build the container image