Add nitro-rpc-client
container in payments stack (#1)
* Add container for nitro-rpc-client * Add nitro-rpc-client service * Update nitro-rpc-client container * Update demo.md in payments stack --------- Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
This commit is contained in:
parent
bd5a9c0ecf
commit
8d50b4172c
@ -34,6 +34,17 @@ services:
|
|||||||
- "4005:4005"
|
- "4005:4005"
|
||||||
- "5005:5005"
|
- "5005:5005"
|
||||||
|
|
||||||
|
nitro-rpc-client:
|
||||||
|
image: cerc/nitro-rpc-client:local
|
||||||
|
hostname: nitro-rpc-client
|
||||||
|
restart: on-failure
|
||||||
|
depends_on:
|
||||||
|
# Wait for the go-nitro node to start
|
||||||
|
go-nitro:
|
||||||
|
condition: service_healthy
|
||||||
|
command: ["bash", "-c", "tail -f /dev/null"]
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
go_nitro_data:
|
go_nitro_data:
|
||||||
nitro_deployment:
|
nitro_deployment:
|
||||||
|
12
app/data/container-build/cerc-nitro-rpc-client/Dockerfile
Normal file
12
app/data/container-build/cerc-nitro-rpc-client/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM node:18.17.1-alpine3.18
|
||||||
|
|
||||||
|
RUN apk --update --no-cache add python3 alpine-sdk bash curl jq
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN echo "Installing dependencies" && \
|
||||||
|
yarn
|
||||||
|
|
||||||
|
RUN cd packages/nitro-rpc-client
|
9
app/data/container-build/cerc-nitro-rpc-client/build.sh
Executable file
9
app/data/container-build/cerc-nitro-rpc-client/build.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build cerc/nitro-rpc-client
|
||||||
|
|
||||||
|
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||||
|
|
||||||
|
# See: https://stackoverflow.com/a/246128/1701505
|
||||||
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
|
docker build -t cerc/nitro-rpc-client:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
@ -21,24 +21,10 @@
|
|||||||
export WATCHER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
export WATCHER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||||
```
|
```
|
||||||
|
|
||||||
* Generate an auth token required to query the go-nitro node's RPC endpoint:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export AUTH_TOKEN=$(curl -s -X POST -H "Content-Type: application/json" --data '{
|
|
||||||
"jsonrpc": "2.0", "id": 1,
|
|
||||||
"method": "get_auth_token",
|
|
||||||
"params": {}
|
|
||||||
}' http://127.0.0.1:4005/api/v1 | jq -r '.result')
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check the payment channel status:
|
* Check the payment channel status:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST -H "Content-Type: application/json" --data "{
|
npm exec -c 'nitro-rpc-client get-payment-channel <WATCHER_UPSTREAM_PAYMENT_CHANNEL> -h <hostname> -p <port>'
|
||||||
\"jsonrpc\": \"2.0\", \"id\": 1,
|
|
||||||
\"method\": \"get_payment_channel\",
|
|
||||||
\"params\": { \"authtoken\": \"$AUTH_TOKEN\", \"payload\": { \"Id\": \"$WATCHER_UPSTREAM_PAYMENT_CHANNEL\" } }
|
|
||||||
}" http://127.0.0.1:4005/api/v1 | jq
|
|
||||||
|
|
||||||
# Expected output:
|
# Expected output:
|
||||||
# {
|
# {
|
||||||
@ -136,11 +122,7 @@
|
|||||||
* Check the watcher - eth-server payment channel status after a few requests:
|
* Check the watcher - eth-server payment channel status after a few requests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST -H "Content-Type: application/json" --data "{
|
npm exec -c 'nitro-rpc-client get-payment-channel <WATCHER_UPSTREAM_PAYMENT_CHANNEL> -h <hostname> -p <port>'
|
||||||
\"jsonrpc\": \"2.0\", \"id\": 1,
|
|
||||||
\"method\": \"get_payment_channel\",
|
|
||||||
\"params\": { \"authtoken\": \"$AUTH_TOKEN\", \"payload\": { \"Id\": \"$WATCHER_UPSTREAM_PAYMENT_CHANNEL\" } }
|
|
||||||
}" http://127.0.0.1:4005/api/v1 | jq
|
|
||||||
|
|
||||||
# Expected output ('PaidSoFar' should be non zero):
|
# Expected output ('PaidSoFar' should be non zero):
|
||||||
# {
|
# {
|
||||||
@ -184,11 +166,7 @@
|
|||||||
* Check the ponder - eth-server payment channel status:
|
* Check the ponder - eth-server payment channel status:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST -H "Content-Type: application/json" --data "{
|
npm exec -c 'nitro-rpc-client get-payment-channel <PONDER_UPSTREAM_PAYMENT_CHANNEL> -h <hostname> -p <port>'
|
||||||
\"jsonrpc\": \"2.0\", \"id\": 1,
|
|
||||||
\"method\": \"get_payment_channel\",
|
|
||||||
\"params\": { \"authtoken\": \"$AUTH_TOKEN\", \"payload\": { \"Id\": \"$PONDER_UPSTREAM_PAYMENT_CHANNEL\" } }
|
|
||||||
}" http://127.0.0.1:4005/api/v1 | jq
|
|
||||||
|
|
||||||
# Expected output ('PaidSoFar' is non zero):
|
# Expected output ('PaidSoFar' is non zero):
|
||||||
# {
|
# {
|
||||||
|
@ -31,6 +31,7 @@ containers:
|
|||||||
- cerc/ipld-eth-server
|
- cerc/ipld-eth-server
|
||||||
- cerc/nitro-contracts
|
- cerc/nitro-contracts
|
||||||
- cerc/go-nitro
|
- cerc/go-nitro
|
||||||
|
- cerc/nitro-rpc-client
|
||||||
# mobymask watcher images
|
# mobymask watcher images
|
||||||
- cerc/watcher-ts
|
- cerc/watcher-ts
|
||||||
- cerc/watcher-mobymask-v3
|
- cerc/watcher-mobymask-v3
|
||||||
|
Loading…
Reference in New Issue
Block a user