Remove go-nitro repo dependency from nitro-node and bridge stacks #12

Merged
nabarun merged 6 commits from ag-use-binary into main 2024-10-17 07:46:15 +00:00
14 changed files with 51 additions and 47 deletions

View File

@ -99,6 +99,9 @@
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
# Build nitro-contracts container image
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts build-containers --force-rebuild
```
- Create a deployment spec-file for Alice's L1 nitro-node:
@ -264,7 +267,7 @@
```bash
export GETH_CHAIN_ID="1212"
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.TestToken.address' /app/deployment/nitro-addresses.json")
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
@ -438,7 +441,7 @@
```bash
export BRIDGE_NITRO_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
export GETH_CHAIN_ID="1212"
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.TestToken.address' /app/deployment/nitro-addresses.json")
```
- Create ledger channel between A and Bridge with custom token

View File

@ -96,6 +96,9 @@
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
# Build nitro-contracts container image
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts build-containers --force-rebuild
```
## Run

View File

@ -3,7 +3,8 @@ name: nitro-contracts
services:
# Optionally deploys the Nitro contracts
nitro-contracts:
image: cerc/nitro-client:local
image: cerc/nitro-contracts:local
working_dir: /app
restart: on-failure
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}

View File

@ -43,4 +43,4 @@ EOF
# Start bridge
echo "Starting nitro-bridge"
./nitro-bridge -config $bridge_config_file
./bridge -config $bridge_config_file

View File

@ -1,29 +1,25 @@
FROM golang:1.22-bullseye AS builder
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y jq netcat-traditional ca-certificates curl
RUN rm -rf /var/lib/apt/lists/*
# Copy files into image
WORKDIR /app
COPY . .
# Install mkcert
RUN curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
RUN chmod +x mkcert-v*-linux-amd64
RUN cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
RUN go mod tidy
# Download binaries
RUN curl -LO https://git.vdb.to/cerc-io/nitro/releases/download/latest/nitro
RUN curl -LO https://git.vdb.to/cerc-io/nitro/releases/download/latest/bridge
# Build the binary
RUN go build -v -o nitro .
RUN go build -o nitro-bridge cmd/start-bridge/main.go
# Make binaries executable
RUN chmod +x ./nitro
RUN chmod +x ./bridge
# Reduce image size
FROM debian:bullseye-slim
RUN apt-get update
RUN apt-get install -y jq netcat ca-certificates
RUN rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/nitro .
COPY --from=builder /app/nitro-bridge .
COPY --from=builder /usr/local/bin/mkcert /usr/local/bin/mkcert
# Verify that binaries are correctly setup
RUN ./nitro help
RUN ./bridge help

View File

@ -4,10 +4,7 @@ RUN apk --update --no-cache add python3 alpine-sdk bash curl jq
WORKDIR /app
COPY . .
RUN echo "Installing dependencies" && \
yarn && yarn build
RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
RUN echo "Installing nitro-rpc-client" && \
npm install -g ./packages/nitro-rpc-client
npm install -g @cerc-io/nitro-rpc-client

View File

@ -0,0 +1,10 @@
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 && yarn build

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Build cerc/nitro-contracts
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-contracts:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro

View File

@ -8,12 +8,6 @@
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
```
- Clone required repositories:
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge setup-repositories
```
- Build container images:
```bash

View File

@ -2,10 +2,9 @@ version: "1.0"
name: bridge
description: "Nitro bridge with contracts deployment and nitro-rpc-client"
repos:
- github.com/cerc-io/go-nitro
containers:
- cerc/nitro-client
- cerc/go-nitro
- cerc/nitro-client
pods:
- nitro-bridge
- nitro-rpc-client

View File

@ -11,8 +11,9 @@
- Clone required repositories:
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts setup-repositories
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts setup-repositories --git-ssh --pull
```
Make sure you have access to the `go-nitro` repository
- Build container images:

View File

@ -4,6 +4,6 @@ description: "Deploy nitro contracts"
repos:
- github.com/cerc-io/go-nitro
containers:
- cerc/nitro-client
- cerc/nitro-contracts
pods:
- nitro-contracts

View File

@ -8,14 +8,6 @@
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
```
- Clone required repositories
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories
```
Note: Replace path to nitro stack with actual path
- Build the container image
```bash

View File

@ -2,7 +2,6 @@ version: "1.0"
name: nitro-node
description: "Nitro node with nitro-rpc-client"
repos:
- github.com/cerc-io/go-nitro
containers:
- cerc/go-nitro
- cerc/nitro-client