Commit e420af74 authored by Conner Fromknecht's avatar Conner Fromknecht

feat: add new BSS to stackman docker setup

parent 16571952
......@@ -18,6 +18,9 @@ jobs:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
batch-submitter: [ts-batch-submitter, go-batch-submitter]
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
......@@ -41,7 +44,7 @@ jobs:
working-directory: ./ops
run: |
./scripts/stats.sh &
docker-compose up -d
docker-compose -f docker-compose.yml -f docker-compose.${{ matrix.batch-submitter }}.yml up -d
- name: Wait for the Sequencer node
working-directory: ./ops
......
BATCH_SUBMITTER ?= docker-compose.ts-batch-submitter.yml
DOCKER_COMPOSE_CMD := docker-compose \
-f docker-compose.yml \
-f $(BATCH_SUBMITTER)
build:
DOCKER_BUILDKIT=1 \
docker-compose \
-f docker-compose.yml build
$(DOCKER_COMPOSE_CMD) \
build
.PHONY: build
up: down
DOCKER_BUILDKIT=1 \
docker-compose \
-f docker-compose.yml \
$(DOCKER_COMPOSE_CMD) \
up --build --detach
.PHONY: up
down:
docker-compose \
-f docker-compose.yml \
$(DOCKER_COMPOSE_CMD) \
down
.PHONY: down
ps:
docker-compose \
-f docker-compose.yml \
$(DOCKER_COMPOSE_CMD) \
ps
.PHONY: ps
up-metrics: down-metrics
DOCKER_BUILDKIT=1 \
docker-compose \
-f docker-compose.yml \
$(DOCKER_COMPOSE_CMD) \
-f docker-compose-metrics.yml \
up --build --detach
.PHONY: up-metrics
down-metrics:
docker-compose \
-f docker-compose.yml \
$(DOCKER_COMPOSE_CMD) \
-f docker-compose-metrics.yml \
down
.PHONY: down-metrics
ps-metrics:
docker-compose \
-f docker-compose.yml \
$(DOCKER_COMPOSE_CMD) \
-f docker-compose-metrics.yml \
ps
.PHONY: ps
......
......@@ -22,9 +22,11 @@ Supplementing the base configuration is an additional metric enabling file, `doc
Also available for testing is the `rpc-proxy` service in the `docker-compose-rpc-proxy.yml` file. It can be used to restrict what RPC methods are allowed to the Sequencer.
The base stack can be started and stopped with a command like this (there is no need to specify the default docker-compose.yml)
The base stack can be started and stopped with a command like this:
```
docker-compose \
-f docker-compose.yml \
-f docker-compose.ts-batch-submitter.yml \
up --build --detach
```
......@@ -34,13 +36,17 @@ To start the stack with monitoring enabled, just add the metric composition file
```
docker-compose \
-f docker-compose.yml \
-f docker-compose.ts-batch-submitter.yml \
-f docker-compose-metrics.yml \
up --build --detach
```
Optionally, run a verifier along the rest of the stack. Run a replica with the same command by switching the service name!
```
docker-compose up --scale \
docker-compose
-f docker-compose.yml \
-f docker-compose.ts-batch-submitter.yml \
up --scale \
verifier=1 \
--build --detach
```
......@@ -52,6 +58,24 @@ A Makefile has been provided for convience. The following targets are available.
- make up-metrics
- make down-metrics
## Using the Go Batch Submitter
The existing Typescript batch submitter is in the process of being reimplemented
in Go. During this transition, the user is required to specify which batch
submitter to use with docker-compose.
The commands above all use the Typescript batch submitter, by specifying
`-f docker-compose.ts-batch-submitter.yml`. This can be swapped out for the go
batch submitter by supplying `-f docker-compose.go-batch-submitter.yml` instead.
Additionally, the `make` targets assume the use of the Typescript batch
submitter. This can be overridden by setting the `BATCH_SUBMITTER` environment
variable, e.g. `BATCH_SUBMITTER=docker-compose.go-batch-submitter.yml make up`.
Once the transition is complete, specifying the desired batch submitter will be
obsolete, and the Go batch submitter will be selected by default from the
`docker-compose.yml` file and `Makefile`.
## Cross domain communication
By default, the `message-relayer` service is turned off. This means that
......
services:
batch_submitter:
depends_on:
- l1_chain
- deployer
- l2geth
build:
context: ..
dockerfile: ./ops/docker/Dockerfile.batch-submitter-service
entrypoint: ./batch-submitter.sh
env_file:
- ./envs/batch-submitter.env
environment:
L1_ETH_RPC: http://l1_chain:8545
L2_ETH_RPC: http://l2geth:8545
URL: http://deployer:8081/addresses.json
BATCH_SUBMITTER_SEQUENCER_PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
BATCH_SUBMITTER_PROPOSER_PRIVATE_KEY: "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
services:
batch_submitter:
depends_on:
- l1_chain
- deployer
- l2geth
build:
context: ..
dockerfile: ./ops/docker/Dockerfile.packages
target: batch-submitter
entrypoint: ./batches.sh
env_file:
- ./envs/batches.env
environment:
L1_NODE_WEB3_URL: http://l1_chain:8545
L2_NODE_WEB3_URL: http://l2geth:8545
URL: http://deployer:8081/addresses.json
SEQUENCER_PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
PROPOSER_PRIVATE_KEY: "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
......@@ -122,25 +122,6 @@ services:
POLLING_INTERVAL: 500
GET_LOGS_INTERVAL: 500
batch_submitter:
depends_on:
- l1_chain
- deployer
- l2geth
build:
context: ..
dockerfile: ./ops/docker/Dockerfile.packages
target: batch-submitter
entrypoint: ./batches.sh
env_file:
- ./envs/batches.env
environment:
L1_NODE_WEB3_URL: http://l1_chain:8545
L2_NODE_WEB3_URL: http://l2geth:8545
URL: http://deployer:8081/addresses.json
SEQUENCER_PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
PROPOSER_PRIVATE_KEY: "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
verifier:
depends_on:
- l1_chain
......
FROM golang:1.15-alpine3.13 as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
COPY ./l2geth /l2geth
COPY ./go/batch-submitter/go.mod ./go/batch-submitter/go.sum /go/batch-submitter/
WORKDIR /go/batch-submitter
RUN go mod graph | grep -v l2geth | awk '{if ($1 !~ "@") print $2}' | xargs -n 1 go get
COPY ./go/batch-submitter/ ./
RUN make
FROM alpine:3.13
RUN apk add --no-cache ca-certificates jq curl
COPY --from=builder /go/batch-submitter/batch-submitter /usr/local/bin/
COPY ./ops/scripts/batch-submitter.sh .
ENTRYPOINT ["batch-submitter"]
......@@ -3,8 +3,11 @@ FROM golang:1.15-alpine3.13 as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git
ADD ./l2geth /go-ethereum
RUN cd /go-ethereum && make geth
COPY ./l2geth/go.mod ./l2geth/go.sum /go-ethereum/
WORKDIR /go-ethereum
RUN go mod download
COPY ./l2geth ./
RUN make geth
# Pull Geth into a second stage deploy alpine container
FROM alpine:3.13
......
BUILD_ENV=development
ETH_NETWORK_NAME=clique
LOG_LEVEL=debug
BATCH_SUBMITTER_LOG_LEVEL=debug
BATCH_SUBMITTER_MAX_L1_TX_SIZE=90000
BATCH_SUBMITTER_MAX_BATCH_SUBMISSION_TIME=0
BATCH_SUBMITTER_POLL_INTERVAL=500ms
BATCH_SUBMITTER_NUM_CONFIRMATIONS=1
BATCH_SUBMITTER_RESUBMISSION_TIMEOUT=1s
BATCH_SUBMITTER_FINALITY_CONFIRMATIONS=0
BATCH_SUBMITTER_RUN_TX_BATCH_SUBMITTER=true
BATCH_SUBMITTER_RUN_STATE_BATCH_SUBMITTER=true
BATCH_SUBMITTER_SAFE_MINIMUM_ETHER_BALANCE=0
BATCH_SUBMITTER_CLEAR_PENDING_TXS=false
#!/bin/sh
set -e
RETRIES=${RETRIES:-40}
if [[ ! -z "$URL" ]]; then
# get the addrs from the URL provided
ADDRESSES=$(curl --fail --show-error --silent --retry-connrefused --retry $RETRIES --retry-delay 5 $URL)
# set the env
export CTC_ADDRESS=$(echo $ADDRESSES | jq -r '.CanonicalTransactionChain')
export SCC_ADDRESS=$(echo $ADDRESSES | jq -r '.StateCommitmentChain')
fi
# waits for l2geth to be up
curl --fail \
--show-error \
--silent \
--retry-connrefused \
--retry $RETRIES \
--retry-delay 1 \
--output /dev/null \
$L2_ETH_RPC
# go
exec batch-submitter "$@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment