Add a stack for Gelato watcher #394
@ -17,7 +17,7 @@ services:
|
||||
- "0.0.0.0:15432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
||||
interval: 20s
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
@ -43,10 +43,10 @@ services:
|
||||
- "0.0.0.0:9000:9000"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "9000"]
|
||||
interval: 20s
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
start_period: 10s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
@ -65,10 +65,14 @@ services:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_ETH_SERVER_GQL_ENDPOINT: ${CERC_ETH_SERVER_GQL_ENDPOINT}
|
||||
CERC_ETH_SERVER_RPC_ENDPOINT: ${CERC_ETH_SERVER_RPC_ENDPOINT}
|
||||
CERC_USE_STATE_SNAPSHOT: ${CERC_USE_STATE_SNAPSHOT}
|
||||
CERC_SNAPSHOT_GQL_ENDPOINT: ${CERC_SNAPSHOT_GQL_ENDPOINT}
|
||||
CERC_SNAPSHOT_BLOCKHASH: ${CERC_SNAPSHOT_BLOCKHASH}
|
||||
command: ["./start-server.sh"]
|
||||
volumes:
|
||||
- ../config/watcher-gelato/watcher-config-template.toml:/app/environments/watcher-config-template.toml
|
||||
- ../config/watcher-gelato/start-server.sh:/app/start-server.sh
|
||||
- ../config/watcher-gelato/create-and-import-checkpoint.sh:/app/create-and-import-checkpoint.sh
|
||||
ports:
|
||||
- "0.0.0.0:3001:3001"
|
||||
- "0.0.0.0:9001:9001"
|
||||
|
13
app/data/config/watcher-gelato/create-and-import-checkpoint.sh
Executable file
13
app/data/config/watcher-gelato/create-and-import-checkpoint.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
CERC_SNAPSHOT_GQL_ENDPOINT="${CERC_SNAPSHOT_GQL_ENDPOINT:-${DEFAULT_CERC_SNAPSHOT_GQL_ENDPOINT}}"
|
||||
CERC_SNAPSHOT_BLOCKHASH="${CERC_SNAPSHOT_BLOCKHASH:-${DEFAULT_CERC_SNAPSHOT_BLOCKHASH}}"
|
||||
|
||||
# TODO Create a checkpoint using GQL endpoint (check and skip if snapshot file already exists)
|
||||
|
||||
echo "Initializing watcher using a state snapshot..."
|
||||
# TODO Import the checkpoint
|
@ -7,6 +7,8 @@ fi
|
||||
CERC_ETH_SERVER_GQL_ENDPOINT="${CERC_ETH_SERVER_GQL_ENDPOINT:-${DEFAULT_CERC_ETH_SERVER_GQL_ENDPOINT}}"
|
||||
CERC_ETH_SERVER_RPC_ENDPOINT="${CERC_ETH_SERVER_RPC_ENDPOINT:-${DEFAULT_CERC_ETH_SERVER_RPC_ENDPOINT}}"
|
||||
|
||||
CERC_USE_STATE_SNAPSHOT="${CERC_USE_STATE_SNAPSHOT:-${DEFAULT_CERC_USE_STATE_SNAPSHOT}}"
|
||||
|
||||
echo "Using ETH server GQL endpoint ${CERC_ETH_SERVER_GQL_ENDPOINT}"
|
||||
echo "Using ETH server RPC endpoint ${CERC_ETH_SERVER_RPC_ENDPOINT}"
|
||||
|
||||
@ -19,8 +21,12 @@ WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
|
||||
# Write the modified content to a new file
|
||||
echo "$WATCHER_CONFIG" > environments/local.toml
|
||||
|
||||
echo "Initializing watcher..."
|
||||
yarn fill --start-block $DEFAULT_CERC_GELATO_START_BLOCK --end-block $DEFAULT_CERC_GELATO_START_BLOCK
|
||||
if [ "$CERC_USE_STATE_SNAPSHOT" = true ] ; then
|
||||
./create-and-import-checkpoint.sh
|
||||
else
|
||||
echo "Initializing watcher using fill..."
|
||||
yarn fill --start-block $DEFAULT_CERC_GELATO_START_BLOCK --end-block $DEFAULT_CERC_GELATO_START_BLOCK
|
||||
fi
|
||||
|
||||
echo "Running active server"
|
||||
DEBUG=vulcanize:* exec node --enable-source-maps dist/server.js
|
||||
|
@ -4,3 +4,10 @@ DEFAULT_CERC_ETH_SERVER_RPC_ENDPOINT="http://ipld-eth-server:8082"
|
||||
|
||||
# Gelato start block
|
||||
DEFAULT_CERC_GELATO_START_BLOCK=11361987
|
||||
|
||||
# Whether to use a state snapshot to initialize the watcher
|
||||
DEFAULT_CERC_USE_STATE_SNAPSHOT=false
|
||||
|
||||
# State snapshot params
|
||||
DEFAULT_CERC_SNAPSHOT_GQL_ENDPOINT=
|
||||
DEFAULT_CERC_SNAPSHOT_BLOCKHASH=
|
||||
|
@ -40,6 +40,14 @@ Create and update an env file to be used in the next step ([defaults](../../conf
|
||||
# External ipld-eth-server endpoints
|
||||
CERC_ETH_SERVER_GQL_ENDPOINT=
|
||||
CERC_ETH_SERVER_RPC_ENDPOINT=
|
||||
|
||||
# Whether to use a state snapshot to initialize the watcher
|
||||
CERC_USE_STATE_SNAPSHOT=false
|
||||
|
||||
# State snapshot params
|
||||
# Required if CERC_USE_STATE_SNAPSHOT is set to true
|
||||
CERC_SNAPSHOT_GQL_ENDPOINT=
|
||||
CERC_SNAPSHOT_BLOCKHASH=
|
||||
```
|
||||
|
||||
* NOTE: If `ipld-eth-server` is running on the host machine, use `host.docker.internal` as the hostname to access the host port(s)
|
||||
|
Loading…
Reference in New Issue
Block a user