Add a service for Nitro reverse payment proxy

This commit is contained in:
Prathamesh Musale 2023-09-27 16:50:54 +05:30
parent 385489f4c4
commit 9c7726c334
6 changed files with 56 additions and 13 deletions

View File

@ -10,14 +10,14 @@ services:
nitro-contracts:
condition: service_completed_successfully
environment:
CHAIN_URL: ${CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
MSG_PORT: ${MSG_PORT:-3005}
RPC_PORT: ${RPC_PORT:-4005}
WS_MSG_PORT: ${WS_MSG_PORT:-5005}
PK: ${PK}
CHAIN_PK: ${CHAIN_PK}
USE_DURABLE_STORE: ${USE_DURABLE_STORE:-true}
DURABLE_STORE_FOLDER: ${DURABLE_STORE_FOLDER:-/app/data/nitro-store}
NITRO_CHAIN_URL: ${NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
NITRO_MSG_PORT: ${NITRO_MSG_PORT:-3005}
NITRO_RPC_PORT: ${NITRO_RPC_PORT:-4005}
NITRO_WS_MSG_PORT: ${NITRO_WS_MSG_PORT:-5005}
NITRO_PK: ${NITRO_PK}
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
NITRO_USE_DURABLE_STORE: ${NITRO_USE_DURABLE_STORE:-true}
NITRO_DURABLE_STORE_FOLDER: ${NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
@ -27,15 +27,15 @@ services:
- nitro_deployment:/app/deployment
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "${MSG_PORT:-3005}"]
test: ["CMD", "nc", "-vz", "localhost", "${NITRO_RPC_PORT:-4005}"]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
ports:
- "3005"
- "4005"
- "5005"
- "${NITRO_MSG_PORT:-3005}"
- "${NITRO_RPC_PORT:-4005}"
- "${NITRO_WS_MSG_PORT:-5005}"
volumes:
go_nitro_data:

View File

@ -0,0 +1,27 @@
version: '3.7'
services:
nitro-reverse-payment-proxy:
image: cerc/go-nitro:local
hostname: nitro-reverse-payment-proxy
restart: on-failure
depends_on:
# Wait for the go-nitro node to start
go-nitro:
condition: service_healthy
environment:
PROXY_ADDRESS: localhost:${PROXY_PORT:-8081}
PROXY_NITRO_ENDPOINT: ${PROXY_NITRO_ENDPOINT:-go-nitro:${NITRO_RPC_PORT:-4005}/api/v1}
PROXY_DESTINATION_URL: ${PROXY_DESTINATION_URL:-http://ipld-eth-server:8081}
PROXY_COST_PER_BYTE: ${PROXY_COST_PER_BYTE:-1}
entrypoint: ["bash", "-c", "/app/run-reverse-payment-proxy.sh"]
volumes:
- ../config/go-nitro/run-reverse-payment-proxy.sh:/app/run-reverse-payment-proxy.sh
healthcheck:
test: ["CMD", "nc", "-vz", "localhost", "${PROXY_PORT:-8081}"]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
ports:
- "${PROXY_PORT:-8081}"

View File

@ -30,4 +30,4 @@ 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}
./nitro -chainurl ${NITRO_CHAIN_URL} -msgport ${NITRO_MSG_PORT} -rpcport ${NITRO_RPC_PORT} -wsmsgport ${NITRO_WS_MSG_PORT} -pk ${NITRO_PK} -chainpk ${NITRO_CHAIN_PK} -naaddress ${NA_ADDRESS} -vpaaddress ${VPA_ADDRESS} -caaddress ${CA_ADDRESS} -usedurablestore ${NITRO_USE_DURABLE_STORE} -durablestorefolder ${NITRO_DURABLE_STORE_FOLDER}

View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
echo "Running Nitro reverse payment proxy"
echo "Using PROXY_ADDRESS ${PROXY_ADDRESS}"
echo "Using PROXY_NITRO_ENDPOINT ${PROXY_NITRO_ENDPOINT}"
echo "Using PROXY_DESTINATION_URL ${PROXY_DESTINATION_URL}"
echo "Using PROXY_COST_PER_BYTE ${PROXY_COST_PER_BYTE}"
./start-reverse-payment-proxy -proxyaddress ${PROXY_ADDRESS} -nitroendpoint=${PROXY_NITRO_ENDPOINT} -destinationurl=${PROXY_DESTINATION_URL} -costperbyte ${PROXY_COST_PER_BYTE}

View File

@ -39,3 +39,4 @@ watcher-mobymask-v3
mobymask-app-v3
go-nitro
nitro-contracts
nitro-reverse-payment-proxy

View File

@ -27,3 +27,4 @@ pods:
- ipld-eth-db
- nitro-contracts
- go-nitro
- nitro-reverse-payment-proxy