Read contract addresses from a volume when running the Nitro node
This commit is contained in:
parent
2b06cbecc2
commit
385489f4c4
@ -2,13 +2,15 @@ version: '3.7'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
go-nitro:
|
go-nitro:
|
||||||
restart: always
|
image: cerc/go-nitro:local
|
||||||
hostname: go-nitro
|
hostname: go-nitro
|
||||||
|
restart: on-failure
|
||||||
|
depends_on:
|
||||||
|
# Wait for Nitro contracts to be deployed
|
||||||
|
nitro-contracts:
|
||||||
|
condition: service_completed_successfully
|
||||||
environment:
|
environment:
|
||||||
CHAIN_URL: ${CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
|
CHAIN_URL: ${CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
|
||||||
NA_ADDRESS: ${NA_ADDRESS}
|
|
||||||
VPA_ADDRESS: ${VPA_ADDRESS}
|
|
||||||
CA_ADDRESS: ${CA_ADDRESS}
|
|
||||||
MSG_PORT: ${MSG_PORT:-3005}
|
MSG_PORT: ${MSG_PORT:-3005}
|
||||||
RPC_PORT: ${RPC_PORT:-4005}
|
RPC_PORT: ${RPC_PORT:-4005}
|
||||||
WS_MSG_PORT: ${WS_MSG_PORT:-5005}
|
WS_MSG_PORT: ${WS_MSG_PORT:-5005}
|
||||||
@ -16,10 +18,14 @@ services:
|
|||||||
CHAIN_PK: ${CHAIN_PK}
|
CHAIN_PK: ${CHAIN_PK}
|
||||||
USE_DURABLE_STORE: ${USE_DURABLE_STORE:-true}
|
USE_DURABLE_STORE: ${USE_DURABLE_STORE:-true}
|
||||||
DURABLE_STORE_FOLDER: ${DURABLE_STORE_FOLDER:-/app/data/nitro-store}
|
DURABLE_STORE_FOLDER: ${DURABLE_STORE_FOLDER:-/app/data/nitro-store}
|
||||||
BOOT_PEERS: []
|
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
|
||||||
image: cerc/go-nitro:local
|
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
||||||
|
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
||||||
|
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
go_nitro_data: /app/data
|
- go_nitro_data:/app/data
|
||||||
|
- nitro_deployment:/app/deployment
|
||||||
|
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "nc", "-v", "localhost", "${MSG_PORT:-3005}"]
|
test: ["CMD", "nc", "-v", "localhost", "${MSG_PORT:-3005}"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
@ -33,3 +39,4 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
go_nitro_data:
|
go_nitro_data:
|
||||||
|
nitro_deployment:
|
||||||
|
@ -15,7 +15,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ../config/nitro-contracts/deploy.sh:/app/deploy.sh
|
- ../config/nitro-contracts/deploy.sh:/app/deploy.sh
|
||||||
- nitro_deployment:/app/deployment
|
- nitro_deployment:/app/deployment
|
||||||
command: ["bash", "-c", "/app/deploy.sh && tail -f"]
|
command: ["bash", "-c", "/app/deploy.sh"]
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
33
app/data/config/go-nitro/run-nitro-node.sh
Executable file
33
app/data/config/go-nitro/run-nitro-node.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
NITRO_ADDRESSES_FILE_PATH="/app/deployment/nitro-addresses.json"
|
||||||
|
|
||||||
|
# Check if CERC_NA_ADDRESS environment variable set to skip contract deployment
|
||||||
|
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"
|
||||||
|
|
||||||
|
NA_ADDRESS=${CERC_NA_ADDRESS}
|
||||||
|
VPA_ADDRESS=${CERC_VPA_ADDRESS}
|
||||||
|
CA_ADDRESS=${CERC_CA_ADDRESS}
|
||||||
|
elif [ -f ${NITRO_ADDRESSES_FILE_PATH} ]; then
|
||||||
|
echo "Reading Nitro addresses from ${NITRO_ADDRESSES_FILE_PATH}"
|
||||||
|
|
||||||
|
NA_ADDRESS=$(jq -r '.nitroAdjudicatorAddress' ${NITRO_ADDRESSES_FILE_PATH})
|
||||||
|
VPA_ADDRESS=$(jq -r '.virtualPaymentAppAddress' ${NITRO_ADDRESSES_FILE_PATH})
|
||||||
|
CA_ADDRESS=$(jq -r '.consensusAppAddress' ${NITRO_ADDRESSES_FILE_PATH})
|
||||||
|
else
|
||||||
|
echo "${NITRO_ADDRESSES_FILE_PATH} not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running Nitro node"
|
||||||
|
|
||||||
|
./nitro -chainurl ${CHAIN_URL} -msgport ${MSG_PORT} -rpcport ${RPC_PORT} -wsmsgport ${WS_MSG_PORT} -pk ${PK} -chainpk ${CHAIN_PK} -naaddress ${NA_ADDRESS} -vpaaddress ${VPA_ADDRESS} -caaddress ${CA_ADDRESS} -usedurablestore ${USE_DURABLE_STORE} -durablestorefolder ${DURABLE_STORE_FOLDER}
|
Loading…
Reference in New Issue
Block a user