Output metadata on prerun.

This commit is contained in:
Thomas E Lackey 2023-04-26 22:58:28 -05:00
parent 5a623fa8d3
commit a17ace0187

View File

@ -7,6 +7,7 @@ set +x
test "$VDB_COMMAND" test "$VDB_COMMAND"
set +e set +e
# docker must be run in privilaged mode for mounts to work # docker must be run in privilaged mode for mounts to work
echo "Setting up /app/geth-rw overlayed /app/geth-ro" echo "Setting up /app/geth-rw overlayed /app/geth-ro"
mkdir -p /tmp/overlay && \ mkdir -p /tmp/overlay && \
@ -16,5 +17,25 @@ mkdir -p /tmp/overlay/work && \
mkdir -p /app/geth-rw && \ mkdir -p /app/geth-rw && \
sudo mount -t overlay overlay -o lowerdir=/app/geth-ro,upperdir=/tmp/overlay/upper,workdir=/tmp/overlay/work /app/geth-rw && \ sudo mount -t overlay overlay -o lowerdir=/app/geth-ro,upperdir=/tmp/overlay/upper,workdir=/tmp/overlay/work /app/geth-rw && \
START_TIME=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
echo "Running the statediff service" && \ echo "Running the statediff service" && \
sudo ./eth-statediff-service "$VDB_COMMAND" --config=config.toml sudo -E ./eth-statediff-service "$VDB_COMMAND" --config=config.toml $*
rc=$?
STOP_TIME=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
if [ $rc -eq 0 ] && [ "$PRERUN_ONLY" == "true" ] && [ ! -z "$PRERUN_RANGE_START" ] && [ ! -z "$PRERUN_RANGE_STOP" ] && [ ! -z "$DATABASE_FILE_CSV_DIR" ] && [ "$DATABASE_FILE_MODE" == "csv" ]; then
cat >"$DATABASE_FILE_CSV_DIR/metadata.json" <<EOF
{
"range": { "start": $PRERUN_RANGE_START, "stop": $PRERUN_RANGE_STOP },
"nodeId": "$ETH_NODE_ID",
"genesisBlock": "$ETH_GENESIS_BLOCK",
"networkId": "$ETH_NETWORK_ID",
"chainId": "$ETH_CHAIN_ID",
"time": { "start": "$START_TIME", "stop": "$STOP_TIME" }
}
EOF
fi
exit $rc