Fixes for running op-geth container

This commit is contained in:
nabarun 2023-03-30 20:53:33 +05:30
parent abb868eaf0
commit 5bf01a587e
4 changed files with 24 additions and 21 deletions

View File

@ -27,11 +27,11 @@ services:
L1_RPC: "http://fixturenet-eth-geth-1:8545" L1_RPC: "http://fixturenet-eth-geth-1:8545"
image: cerc/optimism-op-node:local image: cerc/optimism-op-node:local
volumes: volumes:
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/op-node/generate-l2-config.sh - ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh
# TODO: Integrate # TODO: Integrate
- ../test/contracts-bedrock:/app/packages/contracts-bedrock - ../test/contracts-bedrock:/contracts-bedrock
- op_node_data:/app/op-node - op_node_data:/app
command: ["sh", "generate-l2-config.sh"] command: ["sh", "/app/generate-l2-config.sh"]
op-geth: op-geth:
image: cerc/optimism-l2geth:local image: cerc/optimism-l2geth:local
@ -48,11 +48,11 @@ services:
ports: ports:
- "8545" - "8545"
healthcheck: healthcheck:
test: ["CMD", "nc", "-v", "http://localhost:8545"] test: ["CMD", "nc", "-vz", "localhost:8545"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 10 retries: 10
start_period: 30s start_period: 10s
op-node: op-node:
environment: environment:
@ -63,11 +63,11 @@ services:
condition: service_healthy condition: service_healthy
image: cerc/optimism-op-node:local image: cerc/optimism-op-node:local
volumes: volumes:
- ../config/fixturenet-optimism/run-op-node.sh:/app/op-node/run-op-node.sh - ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh
- op_node_data:/app/op-node - op_node_data:/app
# TODO: Integrate # TODO: Integrate
- ../test/l2-accounts:/l2-accounts - ../test/l2-accounts:/l2-accounts
command: ["sh", "run-op-node.sh"] command: ["sh", "/app/run-op-node.sh"]
volumes: volumes:
op_node_data: op_node_data:

View File

@ -1,14 +1,11 @@
#!/bin/sh #!/bin/sh
set -e set -e
go run cmd/main.go genesis l2 \ op-node genesis l2 \
--deploy-config ../packages/contracts-bedrock/deploy-config/getting-started.json \ --deploy-config /contracts-bedrock/deploy-config/getting-started.json \
--deployment-dir ../packages/contracts-bedrock/deployments/getting-started/ \ --deployment-dir /contracts-bedrock/deployments/getting-started/ \
--outfile.l2 genesis.json \ --outfile.l2 /app/genesis.json \
--outfile.rollup rollup.json \ --outfile.rollup /app/rollup.json \
--l1-rpc $L1_RPC --l1-rpc $L1_RPC
openssl rand -hex 32 > jwt.txt openssl rand -hex 32 > /app/jwt.txt
cat genesis.json
cat jwt.txt

View File

@ -5,13 +5,17 @@ mkdir datadir
echo "pwd" > datadir/password echo "pwd" > datadir/password
# TODO: Add in container build or use other tool
echo "installing jq"
apk update && apk add jq
# Get SEQUENCER KEY from keys.json # Get SEQUENCER KEY from keys.json
SEQUENCER_KEY=`jq '.Sequencer.privateKey' /l2-accounts/keys.json` SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
echo $SEQUENCER_KEY > datadir/block-signer-key echo $SEQUENCER_KEY > datadir/block-signer-key
geth account import --datadir=datadir --password=datadir/password datadir/block-signer-key geth account import --datadir=datadir --password=datadir/password datadir/block-signer-key
while [ ! -f "/op-node/jwt.tx" ] while [ ! -f "/op-node/jwt.txt" ]
do do
echo "Config files not created. Checking after 5 seconds." echo "Config files not created. Checking after 5 seconds."
sleep 5 sleep 5
@ -22,7 +26,7 @@ echo "Config files created by op-node, proceeding with script..."
cp /op-node/genesis.json ./ cp /op-node/genesis.json ./
geth init --datadir=datadir genesis.json geth init --datadir=datadir genesis.json
SEQUENCER_ADDRESS=`jq '.Sequencer.address' /l2-accounts/keys.json` SEQUENCER_ADDRESS=$(jq -r '.Sequencer.address' /l2-accounts/keys.json | tr -d '"')
echo "SEQUENCER_ADDRESS: ${SEQUENCER_ADDRESS}" echo "SEQUENCER_ADDRESS: ${SEQUENCER_ADDRESS}"
cp /op-node/jwt.txt ./ cp /op-node/jwt.txt ./
geth \ geth \

View File

@ -23,6 +23,8 @@ RUN make op-node VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.15 FROM alpine:3.15
RUN apk add --no-cache openssl
COPY --from=builder /app/op-node/bin/op-node /usr/local/bin COPY --from=builder /app/op-node/bin/op-node /usr/local/bin
CMD ["op-node"] CMD ["op-node"]