Update nitro-node stack to use public IP from config (#3)
* Rename nitro-node stack * Add flag for setting public IP * Log values in the nitro-node script * Add command to install nitro-rpc-client * Fix directory name * Set default value for public IP
This commit is contained in:
parent
c0fe155708
commit
192e6feee3
@ -15,6 +15,7 @@ services:
|
|||||||
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
||||||
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
||||||
CERC_BOOT_PEERS: ${CERC_BOOT_PEERS}
|
CERC_BOOT_PEERS: ${CERC_BOOT_PEERS}
|
||||||
|
CERC_PUBLIC_IP: ${CERC_PUBLIC_IP:-127.0.0.1}
|
||||||
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
|
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
|
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
|
||||||
|
@ -15,8 +15,7 @@ services:
|
|||||||
CERC_OPTIMISM_DEPLOYER_PK: ${CERC_GETH_DEPLOYER_PK}
|
CERC_OPTIMISM_DEPLOYER_PK: ${CERC_GETH_DEPLOYER_PK}
|
||||||
CERC_DISABLE_DETERMINISTIC_DEPLOYMENT: true
|
CERC_DISABLE_DETERMINISTIC_DEPLOYMENT: true
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/nitro-contracts/deploy.sh:/app/deploy.sh
|
- ../config/nitro-contracts/deploy.sh:/app/deploy.sh
|
||||||
command: ["bash", "-c", "/app/deploy.sh"]
|
command: ["bash", "-c", "/app/deploy.sh"]
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
name: nitro-rpc-client
|
name: nitro-rpc-client
|
||||||
|
|
||||||
services:
|
services:
|
||||||
nitro-rpc-client:
|
nitro-rpc-client:
|
||||||
image: cerc/nitro-rpc-client:local
|
image: cerc/nitro-rpc-client:local
|
||||||
hostname: nitro-rpc-client
|
hostname: nitro-rpc-client
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
command: ["bash", "-c", "tail -f /dev/null"]
|
command: ["bash", "-c", "tail -f /dev/null"]
|
||||||
|
@ -5,4 +5,26 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./nitro -chainurl ${CERC_NITRO_CHAIN_URL} -msgport ${CERC_NITRO_MSG_PORT} -rpcport ${CERC_NITRO_RPC_PORT} -pk ${CERC_NITRO_PK} -chainpk ${CERC_NITRO_CHAIN_PK} -naaddress ${CERC_NA_ADDRESS} -vpaaddress ${CERC_VPA_ADDRESS} -caaddress ${CERC_CA_ADDRESS}
|
if [ -z "$CERC_NA_ADDRESS" ]; then
|
||||||
|
echo "Error: NA_ADDRESS is not present"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CERC_VPA_ADDRESS" ]; then
|
||||||
|
echo "Error: VPA_ADDRESS is not present"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CERC_CA_ADDRESS" ]; then
|
||||||
|
echo "Error: CA_ADDRESS is not present"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL}"
|
||||||
|
echo "CERC_NITRO_MSG_PORT: ${CERC_NITRO_MSG_PORT}"
|
||||||
|
echo "CERC_NITRO_RPC_PORT: ${CERC_NITRO_RPC_PORT}"
|
||||||
|
echo "CERC_NITRO_PK: ${CERC_NITRO_PK}"
|
||||||
|
echo "CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK}"
|
||||||
|
echo "CERC_PUBLIC_IP: ${CERC_PUBLIC_IP}"
|
||||||
|
|
||||||
|
./nitro -chainurl ${CERC_NITRO_CHAIN_URL} -msgport ${CERC_NITRO_MSG_PORT} -rpcport ${CERC_NITRO_RPC_PORT} -pk ${CERC_NITRO_PK} -chainpk ${CERC_NITRO_CHAIN_PK} -naaddress ${CERC_NA_ADDRESS} -vpaaddress ${CERC_VPA_ADDRESS} -caaddress ${CERC_CA_ADDRESS} -publicip ${CERC_PUBLIC_IP}
|
||||||
|
@ -25,4 +25,4 @@ export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK
|
|||||||
export DISABLE_DETERMINISTIC_DEPLOYMENT=true
|
export DISABLE_DETERMINISTIC_DEPLOYMENT=true
|
||||||
|
|
||||||
yarn contracts:deploy-geth
|
yarn contracts:deploy-geth
|
||||||
yarn contracts:deploy-optimism
|
yarn contracts:deploy-optimism
|
||||||
|
@ -9,4 +9,7 @@ COPY . .
|
|||||||
RUN echo "Installing dependencies" && \
|
RUN echo "Installing dependencies" && \
|
||||||
yarn & yarn build
|
yarn & yarn build
|
||||||
|
|
||||||
|
RUN echo "Installing nitro-rpc-client package" && \
|
||||||
|
npm install -g /app/packages/nitro-rpc-client
|
||||||
|
|
||||||
WORKDIR /app/packages/nitro-rpc-client
|
WORKDIR /app/packages/nitro-rpc-client
|
||||||
|
@ -11,14 +11,15 @@
|
|||||||
- Clone required repositories
|
- Clone required repositories
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stack/go-nitro setup-repositories
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: Replace path to nitro stack with actual path
|
Note: Replace path to nitro stack with actual path
|
||||||
|
|
||||||
- Build the container image
|
- Build the container image
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stack/go-nitro build-containers
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers
|
||||||
```
|
```
|
||||||
|
|
||||||
## Create a deployment
|
## Create a deployment
|
||||||
@ -26,7 +27,7 @@
|
|||||||
- Create a spec file
|
- Create a spec file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stack/go-nitro deploy init --output go-nitro-spec.yml
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output nitro-node-spec.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
- TODO: Edit `network` in the spec file to map container ports to host ports as required:
|
- TODO: Edit `network` in the spec file to map container ports to host ports as required:
|
||||||
@ -41,14 +42,14 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Create deployment
|
- Create deployment
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stack/go-nitro deploy create --spec-file go-nitro-spec.yml --deployment-dir go-nitro-deployment
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file nitro-node-spec.yml --deployment-dir nitro-node-deployment
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
* Inside the `go-nitro-deployment` deployment directory, open `config.env` file and set following env variables:
|
- Inside the `nitro-node-deployment` deployment directory, open `config.env` file and set following env variables:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# URL endpoint of the chain (Example: ws://host.docker.internal:8545)
|
# URL endpoint of the chain (Example: ws://host.docker.internal:8545)
|
||||||
@ -56,16 +57,16 @@
|
|||||||
|
|
||||||
# Private key of account to be used by Nitro node (derived address is used as Nitro address)
|
# Private key of account to be used by Nitro node (derived address is used as Nitro address)
|
||||||
CERC_NITRO_PK=
|
CERC_NITRO_PK=
|
||||||
|
|
||||||
# Private key of the account on chain that is used for funding channels in Nitro node
|
# Private key of the account on chain that is used for funding channels in Nitro node
|
||||||
CERC_NITRO_CHAIN_PK=
|
CERC_NITRO_CHAIN_PK=
|
||||||
|
|
||||||
# Port to be used by P2P message service (Example: 3009)
|
# Port to be used by P2P message service (Example: 3009)
|
||||||
CERC_NITRO_MSG_PORT=
|
CERC_NITRO_MSG_PORT=
|
||||||
|
|
||||||
# Port to be used by RPC server (Example: 4009)
|
# Port to be used by RPC server (Example: 4009)
|
||||||
CERC_NITRO_RPC_PORT=4009
|
CERC_NITRO_RPC_PORT=4009
|
||||||
|
|
||||||
# Optional
|
# Optional
|
||||||
# Contract addresses of NitroAdjudicator, VirtualPaymentApp and ConsensusApp
|
# Contract addresses of NitroAdjudicator, VirtualPaymentApp and ConsensusApp
|
||||||
# TODO: Contracts are deployed if addresses are not set
|
# TODO: Contracts are deployed if addresses are not set
|
||||||
@ -77,5 +78,5 @@
|
|||||||
## Start the deployment
|
## Start the deployment
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir go-nitro-deployment start
|
laconic-so deployment --dir nitro-node-deployment start
|
||||||
```
|
```
|
@ -4,10 +4,8 @@ description: "Stack to demonstrate payments between various services"
|
|||||||
repos:
|
repos:
|
||||||
- github.com/cerc-io/go-nitro
|
- github.com/cerc-io/go-nitro
|
||||||
containers:
|
containers:
|
||||||
- cerc/nitro-contracts
|
|
||||||
- cerc/go-nitro
|
- cerc/go-nitro
|
||||||
# - cerc/nitro-rpc-client
|
# - cerc/nitro-rpc-client
|
||||||
pods:
|
pods:
|
||||||
- go-nitro
|
- go-nitro
|
||||||
- nitro-contracts
|
|
||||||
# - nitro-rpc-client
|
# - nitro-rpc-client
|
Loading…
Reference in New Issue
Block a user