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 ```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild 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: - Create a deployment spec-file for Alice's L1 nitro-node:
@ -264,7 +267,7 @@
```bash ```bash
export GETH_CHAIN_ID="1212" 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 A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293" export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
@ -438,7 +441,7 @@
```bash ```bash
export BRIDGE_NITRO_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 export BRIDGE_NITRO_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
export GETH_CHAIN_ID="1212" 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 - Create ledger channel between A and Bridge with custom token

View File

@ -96,6 +96,9 @@
```bash ```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild 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 ## Run

View File

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

View File

@ -43,4 +43,4 @@ EOF
# Start bridge # Start bridge
echo "Starting nitro-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 # Copy files into image
WORKDIR /app WORKDIR /app
COPY . .
# Install mkcert # Install mkcert
RUN curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64" RUN curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
RUN chmod +x mkcert-v*-linux-amd64 RUN chmod +x mkcert-v*-linux-amd64
RUN cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert 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 # Make binaries executable
RUN go build -v -o nitro . RUN chmod +x ./nitro
RUN go build -o nitro-bridge cmd/start-bridge/main.go RUN chmod +x ./bridge
# Verify that binaries are correctly setup
# Reduce image size RUN ./nitro help
FROM debian:bullseye-slim RUN ./bridge help
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

View File

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

View File

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

View File

@ -11,8 +11,9 @@
- Clone required repositories: - Clone required repositories:
```bash ```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: - Build container images:

View File

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

View File

@ -8,14 +8,6 @@
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack 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 - Build the container image
```bash ```bash

View File

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