diff --git a/app/data/compose/docker-compose-go-nitro.yml b/app/data/compose/docker-compose-go-nitro.yml index f10c861b..552f621c 100644 --- a/app/data/compose/docker-compose-go-nitro.yml +++ b/app/data/compose/docker-compose-go-nitro.yml @@ -11,8 +11,8 @@ services: condition: service_completed_successfully environment: CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546} - CERC_NITRO_PK: ${CERC_NITRO_PK:-febb3b74b0b52d0976f6571d555f4ac8b91c308dfa25c7b58d1e6a7c3f50c781} - CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK:-be4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf} + CERC_NITRO_PK: ${CERC_NITRO_PK:-f36f6dd450892224ee113899195ef922a4795d41c32cafb386d9aab6e0b7b0c6} + CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK:-888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218} 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_MSG_PORT: ${CERC_NITRO_MSG_PORT:-3006} @@ -26,10 +26,9 @@ services: - go_nitro_data:/app/data - nitro_deployment:/app/deployment - ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh - - ../config/go-nitro/tls:/app/tls healthcheck: test: ["CMD", "nc", "-vz", "localhost", "4006"] - interval: 10s + interval: 30s timeout: 5s retries: 10 start_period: 10s diff --git a/app/data/compose/docker-compose-ipld-eth-server-payments.yml b/app/data/compose/docker-compose-ipld-eth-server-payments.yml index 50af67dc..69cc71f7 100644 --- a/app/data/compose/docker-compose-ipld-eth-server-payments.yml +++ b/app/data/compose/docker-compose-ipld-eth-server-payments.yml @@ -1,6 +1,6 @@ version: "3.2" services: - ipld-eth-server: + ipld-eth-server-1: restart: unless-stopped depends_on: ipld-eth-db: @@ -44,7 +44,6 @@ services: - eth_server_nitro_data:/app/nitro-data - nitro_deployment:/app/deployment - ../config/ipld-eth-server/entrypoint.sh:/app/entrypoint.sh - - ../config/go-nitro/tls:/app/nitroTLS ports: - "8081" - "8082" @@ -60,6 +59,55 @@ services: retries: 15 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: eth_server_nitro_data: nitro_deployment: diff --git a/app/data/compose/docker-compose-ponder.yml b/app/data/compose/docker-compose-ponder.yml index 03c53040..51f8b238 100644 --- a/app/data/compose/docker-compose-ponder.yml +++ b/app/data/compose/docker-compose-ponder.yml @@ -8,13 +8,13 @@ services: working_dir: /app/examples/token-erc20 environment: 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_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_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR} 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} command: ["bash", "./ponder-start.sh"] volumes: diff --git a/app/data/compose/docker-compose-watcher-mobymask-v3.yml b/app/data/compose/docker-compose-watcher-mobymask-v3.yml index 83257a08..075c34e6 100644 --- a/app/data/compose/docker-compose-watcher-mobymask-v3.yml +++ b/app/data/compose/docker-compose-watcher-mobymask-v3.yml @@ -89,7 +89,7 @@ services: CERC_PEER_ID: ${CERC_PEER_ID} CERC_ENABLE_UPSTREAM_PAYMENTS: ${CERC_ENABLE_UPSTREAM_PAYMENTS} 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} command: ["bash", "./start-server.sh"] volumes: diff --git a/app/data/config/go-nitro/run-nitro-node.sh b/app/data/config/go-nitro/run-nitro-node.sh index 5849c3d0..62ee6e2a 100755 --- a/app/data/config/go-nitro/run-nitro-node.sh +++ b/app/data/config/go-nitro/run-nitro-node.sh @@ -47,4 +47,4 @@ while true; do sleep $retry_interval 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 "" diff --git a/app/data/config/ipld-eth-server/entrypoint.sh b/app/data/config/ipld-eth-server/entrypoint.sh index 55cfddce..3726ace4 100755 --- a/app/data/config/ipld-eth-server/entrypoint.sh +++ b/app/data/config/ipld-eth-server/entrypoint.sh @@ -1,38 +1,42 @@ #!/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 -if [ -n "$CERC_NA_ADDRESS" ]; then - echo "CERC_NA_ADDRESS is set to '$CERC_NA_ADDRESS'" - echo "CERC_VPA_ADDRESS is set to '$CERC_VPA_ADDRESS'" - echo "CERC_CA_ADDRESS is set to '$CERC_CA_ADDRESS'" - echo "Using the above Nitro addresses" + # Check if CERC_NA_ADDRESS environment variable is set + if [ -n "$CERC_NA_ADDRESS" ]; then + echo "CERC_NA_ADDRESS is set to '$CERC_NA_ADDRESS'" + echo "CERC_VPA_ADDRESS is set to '$CERC_VPA_ADDRESS'" + echo "CERC_CA_ADDRESS is set to '$CERC_CA_ADDRESS'" + echo "Using the above Nitro addresses" - export NITRO_NA_ADDRESS=${CERC_NA_ADDRESS} - export NITRO_VPA_ADDRESS=${CERC_VPA_ADDRESS} - export NITRO_CA_ADDRESS=${CERC_CA_ADDRESS} -else - # Read addresses from a file - # Keep retrying until found - echo "Reading Nitro addresses from ${nitro_addresses_file}" - retry_interval=5 - while true; do - if [[ -e "$nitro_addresses_file" ]]; then - export NITRO_NA_ADDRESS=$(jq -r '.nitroAdjudicatorAddress' ${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_NA_ADDRESS=${CERC_NA_ADDRESS} + export NITRO_VPA_ADDRESS=${CERC_VPA_ADDRESS} + export NITRO_CA_ADDRESS=${CERC_CA_ADDRESS} + else + # Read addresses from a file + # Keep retrying until found + echo "Reading Nitro addresses from ${nitro_addresses_file}" + retry_interval=5 + while true; do + if [[ -e "$nitro_addresses_file" ]]; then + export NITRO_NA_ADDRESS=$(jq -r '.nitroAdjudicatorAddress' ${nitro_addresses_file}) + export NITRO_VPA_ADDRESS=$(jq -r '.virtualPaymentAppAddress' ${nitro_addresses_file}) + export NITRO_CA_ADDRESS=$(jq -r '.consensusAppAddress' ${nitro_addresses_file}) - break - else - echo "File not yet available, retrying in $retry_interval seconds..." - sleep $retry_interval - fi - done + break + else + echo "File not yet available, retrying in $retry_interval seconds..." + sleep $retry_interval + fi + done + fi +} + +if [ "$NITRO_RUN_NODE_IN_PROCESS" = "true" ]; then + read_nitro_addresses fi -# TODO: Wait for chain endpoint - echo "Beginning the ipld-eth-server process" START_CMD="./ipld-eth-server" diff --git a/app/data/config/watcher-mobymask-v3/mobymask-params.env b/app/data/config/watcher-mobymask-v3/mobymask-params.env index 0781d729..7a3f5deb 100644 --- a/app/data/config/watcher-mobymask-v3/mobymask-params.env +++ b/app/data/config/watcher-mobymask-v3/mobymask-params.env @@ -4,7 +4,7 @@ DEFAULT_CERC_ETH_RPC_ENDPOINT="http://fixturenet-eth-geth-1:8545" # 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 DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT="http://fixturenet-eth-geth-1:8545"