Fix ponder setup and update instructions

This commit is contained in:
Prathamesh Musale 2023-10-03 12:09:51 +05:30
parent fadb6ac422
commit c8fe72b392
5 changed files with 84 additions and 27 deletions

View File

@ -4,7 +4,7 @@ services:
ponder-app: ponder-app:
restart: unless-stopped restart: unless-stopped
image: cerc/ponder:local image: cerc/ponder:local
workdir: /app/examples/token-erc20 working_dir: /app/examples/token-erc20
environment: environment:
PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99} PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99}
PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://nitro-reverse-payment-proxy:8081} PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://nitro-reverse-payment-proxy:8081}
@ -14,15 +14,14 @@ services:
CERC_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR} CERC_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR}
CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS} CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS}
CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR} CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR}
CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT} CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT:-5000}
command: ["bash", "ponder-app-start.sh"] command: ["bash", "./ponder-start.sh"]
volumes: volumes:
- ../config/ponder/ponder-app-start.sh:/app/ponder-app-start.sh - ../config/ponder/ponder-start.sh:/app/examples/token-erc20/ponder-start.sh
- ../config/ponder/ponder.config.ts:/app/ponder.config.ts - ../config/ponder/ponder.config.ts:/app/examples/token-erc20/ponder.config.ts
- ../config/ponder/.env.local:/app/.env.local
- peers_ids:/peers - peers_ids:/peers
- nitro_deployment:/nitro - nitro_deployment:/nitro
- ponder_nitro_data:/app/.ponder/nitro-db - ponder_nitro_data:/app/examples/token-erc20/.ponder/nitro-db
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"

View File

@ -5,8 +5,21 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
# Wait till RPC endpoint is available
retry_interval=5
while true; do
rpc_response=$(curl -s -o /dev/null -w '%{http_code}' ${PONDER_RPC_URL_1})
if [ ${rpc_response} = 200 ]; then
echo "RPC endpoint is available"
break
fi
echo "RPC endpoint not yet available, retrying in $retry_interval seconds..."
sleep $retry_interval
done
nitro_addresses_file="/nitro/nitro-addresses.json" nitro_addresses_file="/nitro/nitro-addresses.json"
nitro_addresses_destination_file="/app/nitro-addresses.json" nitro_addresses_destination_file="/app/examples/token-erc20/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
@ -38,21 +51,9 @@ echo "Using ${CERC_PONDER_NITRO_CHAIN_URL} as the RPC endpoint for Nitro txs"
# If not set, check the mounted volume for relay peer id # If not set, check the mounted volume for relay peer id
if [ -z "$CERC_RELAY_MULTIADDR" ]; then if [ -z "$CERC_RELAY_MULTIADDR" ]; then
echo "CERC_RELAY_MULTIADDR not provided, taking from the mounted volume" echo "CERC_RELAY_MULTIADDR not provided, taking from the mounted volume"
CERC_RELAY_MULTIADDR="[\"/ip4/127.0.0.1/tcp/9090/ws/p2p/$(jq -r '.id' /peers/relay-id.json)\"]" CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/$(jq -r '.id' /peers/relay-id.json)"
fi fi
# Wait till RPC endpoint is available
retry_interval=5
while true; do
rpc_response=$(curl -s -o /dev/null -w '%{http_code}' ${PONDER_RPC_URL_1})
if [ ${rpc_response} = 200 ]; then
break
fi
echo "RPC endpoint not yet available, retrying in $retry_interval seconds..."
sleep $retry_interval
done
env_file='.env.local' env_file='.env.local'
echo "PONDER_CHAIN_ID=\"$PONDER_CHAIN_ID\"" > "$env_file" echo "PONDER_CHAIN_ID=\"$PONDER_CHAIN_ID\"" > "$env_file"
echo "PONDER_RPC_URL_1=\"$PONDER_RPC_URL_1\"" >> "$env_file" echo "PONDER_RPC_URL_1=\"$PONDER_RPC_URL_1\"" >> "$env_file"
@ -64,4 +65,5 @@ echo "CERC_UPSTREAM_NITRO_ADDRESS=\"$CERC_UPSTREAM_NITRO_ADDRESS\"" >> "$env_fil
echo "CERC_UPSTREAM_NITRO_MULTIADDR=\"$CERC_UPSTREAM_NITRO_MULTIADDR\"" >> "$env_file" echo "CERC_UPSTREAM_NITRO_MULTIADDR=\"$CERC_UPSTREAM_NITRO_MULTIADDR\"" >> "$env_file"
echo "CERC_UPSTREAM_NITRO_PAY_AMOUNT=\"$CERC_UPSTREAM_NITRO_PAY_AMOUNT\"" >> "$env_file" echo "CERC_UPSTREAM_NITRO_PAY_AMOUNT=\"$CERC_UPSTREAM_NITRO_PAY_AMOUNT\"" >> "$env_file"
pnpm start # Keep the container running
tail -f

View File

@ -0,0 +1,25 @@
# Required for:
# Nitro contracts deployment
# MobyMask contract deployment
CERC_PRIVATE_KEY_DEPLOYER="0x888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218"
# ipld-eth-server's go-nitro node credentials
NITRO_PK=2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d
NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
# Watcher's nitro node credentials
CERC_WATCHER_NITRO_PK="0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4"
# Used for sending MobyMask chain txs; also serves as chain pk for watcher's nitro node
CERC_PRIVATE_KEY_PEER="111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f"
# Ponder app's nitro node credentials
CERC_PONDER_NITRO_PK=58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f
CERC_PONDER_NITRO_CHAIN_PK=fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0
# Used by watcher and ponder app for sending upstream payments
CERC_UPSTREAM_NITRO_ADDRESS="0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE" # corresponds to NITRO_PK
CERC_UPSTREAM_NITRO_MULTIADDR="/dns4/go-nitro/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv"
# Used by the the MobyMask app to make payments to watcher
CERC_PAYMENT_NITRO_ADDRESS="0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94" # corresponds to CERC_WATCHER_NITRO_PK

View File

@ -16,10 +16,41 @@ laconic-so --stack fixturenet-payments build-containers
## Deploy ## Deploy
Deploy the stack: ### Configuration
Create an env file with contents from [.env.fixturenet](./.env.fixturenet) to be used in the next step
### Deploy the stack:
```bash ```bash
laconic-so --stack fixturenet-payments deploy --cluster [CLUSTER_NAME] up laconic-so --stack fixturenet-payments deploy --cluster [CLUSTER_NAME] --env-file <PATH_TO_ENV_FILE> up
# Exposed on host ports:
# 5005: go-nitro node's p2p msg port
# 8081: reverse payment proxy's RPC endpoint
# 15432: MobyMask v3 watcher's db endpoint
# 3001: MobyMask v3 watcher endpoint
# 9090: MobyMask v3 watcher relay node endpoint
# 8080: MobyMask snap
# 3004: MobyMask v3 app
```
* Check the logs of the MobyMask contract deployment container to get the deployed contract's address and generated root invite link:
```bash
docker logs -f $(docker ps -aq --filter name="mobymask-1")
```
* Check the reverse payment proxy container logs:
```bash
docker logs -f $(docker ps -aq --filter name="nitro-reverse-payment-proxy")
```
* Run the ponder app:
```bash
docker exec -it payments-ponder-app-1 bash -c "pnpm start"
``` ```
## Clean up ## Clean up

View File

@ -8,17 +8,17 @@ repos:
- github.com/cerc-io/ipld-eth-db - github.com/cerc-io/ipld-eth-db
- github.com/cerc-io/ipld-eth-server - github.com/cerc-io/ipld-eth-server
# nitro repos # nitro repos
- github.com/cerc-io/ts-nitro - github.com/cerc-io/ts-nitro@v0.1.12
- github.com/cerc-io/go-nitro@pm-disable-compression # TODO: Update - github.com/cerc-io/go-nitro@pm-disable-compression # TODO: Update
# mobymask watcher repos # mobymask watcher repos
- github.com/cerc-io/watcher-ts@v0.2.61 - github.com/cerc-io/watcher-ts@v0.2.61
- github.com/cerc-io/mobymask-v2-watcher-ts@pm-upstream-payments # TODO: Update - github.com/cerc-io/mobymask-v2-watcher-ts@v3 # TODO: Update
- github.com/cerc-io/MobyMask@v0.1.3 - github.com/cerc-io/MobyMask@v0.1.3
# mobymask app repos # mobymask app repos
- github.com/cerc-io/mobymask-snap - github.com/cerc-io/mobymask-snap
- github.com/cerc-io/mobymask-ui@v0.2.0 - github.com/cerc-io/mobymask-ui@v0.2.0
# ponder repo # ponder repo
- github.com/cerc-io/ponder@paid-eth-rpc # TODO: Update - github.com/cerc-io/ponder@laconic
containers: containers:
# fixturenet images # fixturenet images
- cerc/go-ethereum - cerc/go-ethereum