Add healthcheck to nitro-rpc-client container (#10)

Part of [Create bridge channel in go-nitro](https://www.notion.so/Create-bridge-channel-in-go-nitro-22ce80a0d8ae4edb80020a8f250ea270)

Co-authored-by: Neeraj <neeraj.rtly@gmail.com>
Reviewed-on: #10
Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
This commit is contained in:
Prathamesh Musale 2024-09-17 13:54:17 +00:00 committed by nabarun
parent b3e58e8d74
commit 2826bbd67d
4 changed files with 18 additions and 12 deletions

View File

@ -531,7 +531,7 @@
- Open new terminal, check that no channels exist on L2
```bash
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge"
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4005 -h nitro-bridge"
# Expected output:
# []
@ -558,7 +558,7 @@
- Once direct-fund objective is complete, bridge will create mirrored channel on L2
- Check node A' logs to see bridged-fund objective completed
```bash
laconic-so deployment --dir l2alice-nitro-deployment logs nitro-node -f --tail 30
@ -636,7 +636,7 @@
- Check status of all L2 mirrored ledger channels
```bash
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge"
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4005 -h nitro-bridge"
# Expected output:
# [
@ -731,7 +731,7 @@
```
- Check largest voucher received on the payment channel
```bash
laconic-so deployment --dir l2charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-voucher $PAYMENT_CHANNEL_ID -p 4005 -h nitro-node"
@ -740,7 +740,7 @@
# Amount: 200,
# ChannelId: '0xb29aeb32c9495a793ebf7bd116232075d1e7bfe89fc82281c7d498e3ffd3e3bf',
# Signature: '0x8fbdb9bb91932b422c30cc07bf422e4f1c3ae1be1b60e01bbfcb193ae5c8f5b0571de84667d87b5ef9b737287faa0ddf41f1f9fc159673205679622c69fd69d81b'
# }
# }
```
- Check payment channel status again to view updated channel state
@ -775,7 +775,7 @@
```bash
laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4005 -h nitro-node"
# Expected output:
# Expected output:
# [
# {
# "ID": "0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179",

View File

@ -3,7 +3,7 @@ name: nitro-bridge
services:
l2-nitro-contracts:
image: cerc/nitro-client:local
restart: on-failure
restart: on-failure
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
OPTIMISM_DEPLOYER_PK: ${OPTIMISM_DEPLOYER_PK}
@ -27,7 +27,7 @@ services:
restart: unless-stopped
depends_on:
l2-nitro-contracts:
condition: service_started
condition: service_started
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID:-42069}
@ -37,7 +37,7 @@ services:
NITRO_SC_PK: ${NITRO_SC_PK}
NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT:-3005}
NITRO_L2_MSG_PORT: ${NITRO_L2_MSG_PORT:-3006}
NITRO_RPC_PORT: ${NITRO_RPC_PORT:-4006}
NITRO_RPC_PORT: ${NITRO_RPC_PORT:-4005}
NITRO_PUBLIC_P2P_HOST: ${NITRO_PUBLIC_P2P_HOST:-127.0.0.1}
NITRO_L1_EXT_MULTIADDR: ${NITRO_L1_EXT_MULTIADDR}
NITRO_L2_EXT_MULTIADDR: ${NITRO_L2_EXT_MULTIADDR}
@ -56,7 +56,7 @@ services:
ports:
- 3005
- 3006
- 4006
- 4005
healthcheck:
test: ["CMD", "nc", "-vz", "localhost", "3006"]
interval: 30s

View File

@ -8,6 +8,12 @@ services:
environment:
NODE_EXTRA_CA_CERTS: "/app/mkcert-caroot/rootCA.pem"
command: ["bash", "-c", "tail -f /dev/null"]
healthcheck:
test: ["CMD-SHELL", "nitro-rpc-client --version -p 4005"]
interval: 30s
timeout: 5s
retries: 10
start_period: 10s
volumes:
- nitro_node_caroot:/app/mkcert-caroot

View File

@ -36,7 +36,7 @@
go-nitro:
- 3005:3005
- 3006:3006
- 4006:4006
- 4005:4005
```
- Create deployment
@ -72,7 +72,7 @@
NITRO_L2_MSG_PORT=3006
# Port to be used by RPC server
NITRO_RPC_PORT=4006
NITRO_RPC_PORT=4005
NITRO_PUBLIC_P2P_HOST=127.0.0.1