Add stack for running individual nitro node (#2)

* Build go-nitro container image

* Run nitro node using stack

* Add config setup in readme for running nitro node

* Add script for deploying contracts

---------

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Co-authored-by: Neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
2024-07-18 10:22:37 +05:30
committed by GitHub
co-authored by Shreerang Kale Neeraj
parent e25a412c86
commit c0fe155708
9 changed files with 128 additions and 148 deletions
+75 -13
View File
@@ -1,19 +1,81 @@
# Go-nitro
## Clone the stack repo
<!-- TODO: Test clone stack repo command -->
## Setup
## Clone required repositories
- Clone the stack repo
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
```
- Clone required repositories
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stack/go-nitro setup-repositories
```
Note: Replace path to nitro stack with actual path
- Build the container image
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stack/go-nitro build-containers
```
## Create a deployment
- Create a spec file
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stack/go-nitro deploy init --output go-nitro-spec.yml
```
- TODO: Edit `network` in the spec file to map container ports to host ports as required:
```bash
network:
ports:
go-nitro:
- 3006:3006
- 4006:4006
- 5006:5006
```
- Create deployment
```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
```
## Configuration
* Inside the `go-nitro-deployment` deployment directory, open `config.env` file and set following env variables:
```bash
# URL endpoint of the chain (Example: ws://host.docker.internal:8545)
CERC_NITRO_CHAIN_URL=
# Private key of account to be used by Nitro node (derived address is used as Nitro address)
CERC_NITRO_PK=
# Private key of the account on chain that is used for funding channels in Nitro node
CERC_NITRO_CHAIN_PK=
# Port to be used by P2P message service (Example: 3009)
CERC_NITRO_MSG_PORT=
# Port to be used by RPC server (Example: 4009)
CERC_NITRO_RPC_PORT=4009
# Optional
# Contract addresses of NitroAdjudicator, VirtualPaymentApp and ConsensusApp
# TODO: Contracts are deployed if addresses are not set
CERC_NA_ADDRESS=
CERC_VPA_ADDRESS=
CERC_CA_ADDRESS=
```
## Start the deployment
<!-- TODO: Update path to nitro stack -->
```bash
laconic-so --stack /<path-to-nitro-stack>/nitro-stack/stack-orchestrator/stack/go-nitro setup-repositories
laconic-so deployment --dir go-nitro-deployment start
```
Note: Replace path to nitro stack with actual path
## Build the container image
<!-- TODO: Update path to nitro stack -->
```bash
laconic-so --stack /<path-to-nitro-stack>/nitro-stack/stack-orchestrator/stack/go-nitro build-containers
```
+4 -5
View File
@@ -5,10 +5,9 @@ repos:
- github.com/cerc-io/go-nitro
containers:
- cerc/nitro-contracts
- cerc/nitro-rpc-client
# TODO: Uncomment after building container image
# - cerc/go-nitro
- cerc/go-nitro
# - cerc/nitro-rpc-client
pods:
- nitro-contracts
- go-nitro
- nitro-rpc-client
- nitro-contracts
# - nitro-rpc-client