Add a separate service for ipld-eth-server with remote Nitro node

This commit is contained in:
Prathamesh Musale 2023-10-17 17:51:13 +05:30
parent 5c4945cafb
commit 395d05837a
7 changed files with 90 additions and 39 deletions

View File

@ -11,8 +11,8 @@ services:
condition: service_completed_successfully condition: service_completed_successfully
environment: environment:
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546} CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
CERC_NITRO_PK: ${CERC_NITRO_PK:-febb3b74b0b52d0976f6571d555f4ac8b91c308dfa25c7b58d1e6a7c3f50c781} CERC_NITRO_PK: ${CERC_NITRO_PK:-f36f6dd450892224ee113899195ef922a4795d41c32cafb386d9aab6e0b7b0c6}
CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK:-be4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf} CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK:-888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218}
CERC_NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-true} CERC_NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-true}
CERC_NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store} CERC_NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
CERC_NITRO_MSG_PORT: ${CERC_NITRO_MSG_PORT:-3006} CERC_NITRO_MSG_PORT: ${CERC_NITRO_MSG_PORT:-3006}
@ -26,10 +26,9 @@ services:
- go_nitro_data:/app/data - go_nitro_data:/app/data
- nitro_deployment:/app/deployment - nitro_deployment:/app/deployment
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh - ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
- ../config/go-nitro/tls:/app/tls
healthcheck: healthcheck:
test: ["CMD", "nc", "-vz", "localhost", "4006"] test: ["CMD", "nc", "-vz", "localhost", "4006"]
interval: 10s interval: 30s
timeout: 5s timeout: 5s
retries: 10 retries: 10
start_period: 10s start_period: 10s

View File

@ -1,6 +1,6 @@
version: "3.2" version: "3.2"
services: services:
ipld-eth-server: ipld-eth-server-1:
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
ipld-eth-db: ipld-eth-db:
@ -44,7 +44,6 @@ services:
- eth_server_nitro_data:/app/nitro-data - eth_server_nitro_data:/app/nitro-data
- nitro_deployment:/app/deployment - nitro_deployment:/app/deployment
- ../config/ipld-eth-server/entrypoint.sh:/app/entrypoint.sh - ../config/ipld-eth-server/entrypoint.sh:/app/entrypoint.sh
- ../config/go-nitro/tls:/app/nitroTLS
ports: ports:
- "8081" - "8081"
- "8082" - "8082"
@ -60,6 +59,55 @@ services:
retries: 15 retries: 15
start_period: 5s start_period: 5s
ipld-eth-server-2:
restart: unless-stopped
depends_on:
ipld-eth-db:
condition: service_healthy
go-nitro:
condition: service_healthy
image: cerc/ipld-eth-server:local
environment:
SERVER_HTTP_PATH: 0.0.0.0:8081
SERVER_GRAPHQL: "true"
SERVER_GRAPHQLPATH: 0.0.0.0:8082
VDB_COMMAND: "serve"
ETH_CHAIN_CONFIG: "/tmp/chain.json"
DATABASE_NAME: cerc_testing
DATABASE_HOSTNAME: ipld-eth-db
DATABASE_PORT: 5432
DATABASE_USER: "vdbm"
DATABASE_PASSWORD: "password"
ETH_CHAIN_ID: 99
ETH_FORWARD_ETH_CALLS: "false"
ETH_FORWARD_GET_STORAGE_AT: "false"
ETH_PROXY_ON_ERROR: "false"
METRICS: "true"
PROM_HTTP: "true"
PROM_HTTP_ADDR: "0.0.0.0"
PROM_HTTP_PORT: "8090"
LOG_LEVEL: "debug"
CERC_REMOTE_DEBUG: ${CERC_REMOTE_DEBUG:-true}
NITRO_RUN_NODE_IN_PROCESS: ${CERC_NITRO_RUN_NODE_IN_PROCESS:-false}
NITRO_ENDPOINT: ${CERC_NITRO_ENDPOINT:-go-nitro:4006/api/v1}
entrypoint: ["bash", "-c", "/app/entrypoint.sh"]
volumes:
- type: bind
source: ../config/ipld-eth-server/chain.json
target: /tmp/chain.json
- ../config/ipld-eth-server/entrypoint.sh:/app/entrypoint.sh
ports:
- "8081"
- "8082"
- "8090"
- "40000"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "8081"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
volumes: volumes:
eth_server_nitro_data: eth_server_nitro_data:
nitro_deployment: nitro_deployment:

View File

@ -8,13 +8,13 @@ services:
working_dir: /app/examples/token-erc20 working_dir: /app/examples/token-erc20
environment: environment:
CERC_PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99} CERC_PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99}
CERC_PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://ipld-eth-server:8081} CERC_PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://ipld-eth-server-2:8081}
CERC_PONDER_NITRO_PK: ${CERC_PONDER_INDEXER_NITRO_PK:-58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f} CERC_PONDER_NITRO_PK: ${CERC_PONDER_INDEXER_NITRO_PK:-58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f}
CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_INDEXER_NITRO_CHAIN_PK:-fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0} CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_INDEXER_NITRO_CHAIN_PK:-fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0}
CERC_PONDER_NITRO_CHAIN_URL: ${CERC_PONDER_NITRO_CHAIN_URL:-http://fixturenet-eth-geth-1:8546} CERC_PONDER_NITRO_CHAIN_URL: ${CERC_PONDER_NITRO_CHAIN_URL:-http://fixturenet-eth-geth-1:8546}
CERC_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR} CERC_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR}
CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE} CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE}
CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR:-/dns4/ipld-eth-server/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv} CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR:-/dns4/go-nitro/tcp/5006/ws/p2p/16Uiu2HAmNUiX7bpCpbo5JdqEebp85ptGU2Vk2AT9E3BykvbwQ3F9}
CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT:-100} CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT:-100}
command: ["bash", "./ponder-start.sh"] command: ["bash", "./ponder-start.sh"]
volumes: volumes:

View File

@ -89,7 +89,7 @@ services:
CERC_PEER_ID: ${CERC_PEER_ID} CERC_PEER_ID: ${CERC_PEER_ID}
CERC_ENABLE_UPSTREAM_PAYMENTS: ${CERC_ENABLE_UPSTREAM_PAYMENTS} CERC_ENABLE_UPSTREAM_PAYMENTS: ${CERC_ENABLE_UPSTREAM_PAYMENTS}
CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE} CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE}
CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR:-/dns4/ipld-eth-server/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv} CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR:-/dns4/ipld-eth-server-1/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv}
CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT:-100} CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT:-100}
command: ["bash", "./start-server.sh"] command: ["bash", "./start-server.sh"]
volumes: volumes:

View File

@ -47,4 +47,4 @@ while true; do
sleep $retry_interval sleep $retry_interval
done done
./nitro -chainurl ${CERC_NITRO_CHAIN_URL} -msgport ${CERC_NITRO_MSG_PORT} -rpcport ${CERC_NITRO_RPC_PORT} -wsmsgport ${CERC_NITRO_WS_MSG_PORT} -pk ${CERC_NITRO_PK} -chainpk ${CERC_NITRO_CHAIN_PK} -naaddress ${NA_ADDRESS} -vpaaddress ${VPA_ADDRESS} -caaddress ${CA_ADDRESS} -usedurablestore ${CERC_NITRO_USE_DURABLE_STORE} -durablestorefolder ${CERC_NITRO_DURABLE_STORE_FOLDER} -publicip "0.0.0.0" ./nitro -chainurl ${CERC_NITRO_CHAIN_URL} -msgport ${CERC_NITRO_MSG_PORT} -rpcport ${CERC_NITRO_RPC_PORT} -wsmsgport ${CERC_NITRO_WS_MSG_PORT} -pk ${CERC_NITRO_PK} -chainpk ${CERC_NITRO_CHAIN_PK} -naaddress ${NA_ADDRESS} -vpaaddress ${VPA_ADDRESS} -caaddress ${CA_ADDRESS} -usedurablestore ${CERC_NITRO_USE_DURABLE_STORE} -durablestorefolder ${CERC_NITRO_DURABLE_STORE_FOLDER} -publicip "0.0.0.0" -tlscertfilepath "" -tlsKeyFilepath ""

View File

@ -1,38 +1,42 @@
#!/bin/sh #!/bin/sh
nitro_addresses_file="/app/deployment/nitro-addresses.json" read_nitro_addresses() {
nitro_addresses_file="/app/deployment/nitro-addresses.json"
# Check if CERC_NA_ADDRESS environment variable is set # Check if CERC_NA_ADDRESS environment variable is set
if [ -n "$CERC_NA_ADDRESS" ]; then if [ -n "$CERC_NA_ADDRESS" ]; then
echo "CERC_NA_ADDRESS is set to '$CERC_NA_ADDRESS'" echo "CERC_NA_ADDRESS is set to '$CERC_NA_ADDRESS'"
echo "CERC_VPA_ADDRESS is set to '$CERC_VPA_ADDRESS'" echo "CERC_VPA_ADDRESS is set to '$CERC_VPA_ADDRESS'"
echo "CERC_CA_ADDRESS is set to '$CERC_CA_ADDRESS'" echo "CERC_CA_ADDRESS is set to '$CERC_CA_ADDRESS'"
echo "Using the above Nitro addresses" echo "Using the above Nitro addresses"
export NITRO_NA_ADDRESS=${CERC_NA_ADDRESS} export NITRO_NA_ADDRESS=${CERC_NA_ADDRESS}
export NITRO_VPA_ADDRESS=${CERC_VPA_ADDRESS} export NITRO_VPA_ADDRESS=${CERC_VPA_ADDRESS}
export NITRO_CA_ADDRESS=${CERC_CA_ADDRESS} export NITRO_CA_ADDRESS=${CERC_CA_ADDRESS}
else else
# Read addresses from a file # Read addresses from a file
# Keep retrying until found # Keep retrying until found
echo "Reading Nitro addresses from ${nitro_addresses_file}" echo "Reading Nitro addresses from ${nitro_addresses_file}"
retry_interval=5 retry_interval=5
while true; do while true; do
if [[ -e "$nitro_addresses_file" ]]; then if [[ -e "$nitro_addresses_file" ]]; then
export NITRO_NA_ADDRESS=$(jq -r '.nitroAdjudicatorAddress' ${nitro_addresses_file}) export NITRO_NA_ADDRESS=$(jq -r '.nitroAdjudicatorAddress' ${nitro_addresses_file})
export NITRO_VPA_ADDRESS=$(jq -r '.virtualPaymentAppAddress' ${nitro_addresses_file}) export NITRO_VPA_ADDRESS=$(jq -r '.virtualPaymentAppAddress' ${nitro_addresses_file})
export NITRO_CA_ADDRESS=$(jq -r '.consensusAppAddress' ${nitro_addresses_file}) export NITRO_CA_ADDRESS=$(jq -r '.consensusAppAddress' ${nitro_addresses_file})
break break
else else
echo "File not yet available, retrying in $retry_interval seconds..." echo "File not yet available, retrying in $retry_interval seconds..."
sleep $retry_interval sleep $retry_interval
fi fi
done done
fi
}
if [ "$NITRO_RUN_NODE_IN_PROCESS" = "true" ]; then
read_nitro_addresses
fi fi
# TODO: Wait for chain endpoint
echo "Beginning the ipld-eth-server process" echo "Beginning the ipld-eth-server process"
START_CMD="./ipld-eth-server" START_CMD="./ipld-eth-server"

View File

@ -4,7 +4,7 @@
DEFAULT_CERC_ETH_RPC_ENDPOINT="http://fixturenet-eth-geth-1:8545" DEFAULT_CERC_ETH_RPC_ENDPOINT="http://fixturenet-eth-geth-1:8545"
# ETH RPC endpoint used for queries in the watcher # ETH RPC endpoint used for queries in the watcher
DEFAULT_CERC_ETH_RPC_QUERY_ENDPOINT="http://ipld-eth-server:8081" DEFAULT_CERC_ETH_RPC_QUERY_ENDPOINT="http://ipld-eth-server-1:8081"
# ETH RPC endpoint used for mutations in the watcher # ETH RPC endpoint used for mutations in the watcher
DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT="http://fixturenet-eth-geth-1:8545" DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT="http://fixturenet-eth-geth-1:8545"