From 5a87111f3c223250201d17ac1ff609553b447242 Mon Sep 17 00:00:00 2001 From: Marcos Maceo Date: Sat, 14 Dec 2024 00:22:59 +0400 Subject: [PATCH 1/2] feat: add nethermind --- .env.sample | 12 ++++++ .env.sample.hekla | 1 + README.md | 31 +++++++++++++++ docker-compose.yml | 61 +++++++++++++++-------------- script/start-driver.sh | 10 ++++- script/start-l2-execution-engine.sh | 53 +++++++++++++++++++++++++ script/start-proposer-hekla.sh | 8 +++- script/start-proposer.sh | 8 +++- 8 files changed, 150 insertions(+), 34 deletions(-) create mode 100755 script/start-l2-execution-engine.sh diff --git a/.env.sample b/.env.sample index f7a87cd5..c7994801 100644 --- a/.env.sample +++ b/.env.sample @@ -1,6 +1,7 @@ ############################### DEFAULT ##################################### # Chain ID CHAIN_ID=167000 +NETWORK=taiko-mainnet # Exposed ports PORT_L2_EXECUTION_ENGINE_HTTP=8547 @@ -21,6 +22,17 @@ TAIKO_L1_ADDRESS=0x06a9Ab27c7e2255df1815E6CC0168d7755Feb19a TAIKO_TOKEN_L1_ADDRESS=0x10dea67478c5F8C5E2D90e5E9B26dBe60c54d800 TAIKO_L2_ADDRESS=0x1670000000000000000000000000000000010001 +# L2 Execution Engine Configuration +# L2_EXECUTION_ENGINE=taiko-geth +L2_EXECUTION_ENGINE=nethermind +# Options: taiko-geth or nethermind +# L2_EXECUTION_ENGINE_IMAGE=us-docker.pkg.dev/evmchain/images/taiko-geth:v1.11.1 +L2_EXECUTION_ENGINE_IMAGE=nethermind/nethermind:1.30.1 +# For Nethermind use: nethermind/nethermind:1.30.1 + +# If using Nethermind, this command will be used instead of the default Geth command +# L2_EXECUTION_ENGINE_START_COMMAND= + # P2P DISABLE_P2P_SYNC=false P2P_SYNC_URL=https://rpc.mainnet.taiko.xyz diff --git a/.env.sample.hekla b/.env.sample.hekla index 3115e1e3..0058b416 100644 --- a/.env.sample.hekla +++ b/.env.sample.hekla @@ -1,6 +1,7 @@ ############################### DEFAULT ##################################### # Chain ID CHAIN_ID=167009 +NETWORK=taiko-hekla # Exposed ports PORT_L2_EXECUTION_ENGINE_HTTP=8547 diff --git a/README.md b/README.md index 2545f7c1..fcfb2ffb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,34 @@ # simple-taiko-node Get started with the [guide](https://docs.taiko.xyz/guides/node-operators/run-a-taiko-node-with-docker/). + +## Execution Engine Options + +This repository supports two L2 execution engine options: + +1. **Taiko-Geth (Default)** + - Use the default `docker-compose.yml` and `.env.sample` + - Command: `docker compose up` + +2. **Nethermind** + - Use `docker-compose-nethermind.yml` and `.env.sample.nethermind` + - Command: `docker compose -f docker-compose-nethermind.yml up` + +For Hekla testnet: +- Taiko-Geth: Use `docker-compose-hekla.yml` +- Nethermind: Use `docker-compose-nethermind-hekla.yml` + +## Configuration + +1. Copy the appropriate .env sample file: + ```bash + # For Taiko-Geth + cp .env.sample .env + + # For Nethermind + cp .env.sample.nethermind .env + ``` + +2. Configure your environment variables in the `.env` file. + +3. Start the node with the appropriate docker-compose file for your chosen execution engine. diff --git a/docker-compose.yml b/docker-compose.yml index 6a977beb..f0a05b8c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,49 +6,32 @@ x-logging: &logging services: l2_execution_engine: - image: us-docker.pkg.dev/evmchain/images/taiko-geth:v1.11.1 + image: ${L2_EXECUTION_ENGINE_IMAGE} restart: unless-stopped pull_policy: always env_file: - .env stop_grace_period: 3m volumes: - - l2_execution_engine_data:/data/taiko-geth + - l2_execution_engine_data:/data + - ./script:/script + - ./script/util/nethermind-config.json:/nethermind/config.json + - jwt_secret:/data/jwt ports: - "${PORT_L2_EXECUTION_ENGINE_METRICS}:6060" - "${PORT_L2_EXECUTION_ENGINE_HTTP}:8545" - "${PORT_L2_EXECUTION_ENGINE_WS}:8546" - "${PORT_L2_EXECUTION_ENGINE_P2P}:${PORT_L2_EXECUTION_ENGINE_P2P}" - "${PORT_L2_EXECUTION_ENGINE_P2P}:${PORT_L2_EXECUTION_ENGINE_P2P}/udp" - command: | - --taiko - --networkid "${CHAIN_ID}" - --gcmode archive - --datadir /data/taiko-geth - --metrics - --metrics.addr "0.0.0.0" - --bootnodes ${BOOT_NODES} - --authrpc.addr "0.0.0.0" - --authrpc.vhosts "*" - --http - --http.api debug,eth,net,web3,txpool,taiko - --http.addr "0.0.0.0" - --http.vhosts "*" - --ws - --ws.api debug,eth,net,web3,txpool,taiko - --ws.addr "0.0.0.0" - --ws.origins "*" - --gpo.defaultprice "10000000" - --port ${PORT_L2_EXECUTION_ENGINE_P2P} - --discovery.port ${PORT_L2_EXECUTION_ENGINE_P2P} - --maxpeers ${MAXPEERS:-50} - --maxpendpeers ${MAXPENDPEERS:-0} - ${GETH_ADDITIONAL_ARGS:-} + entrypoint: + - /bin/sh + - -c + - "/script/start-l2-execution-engine.sh" + networks: + - taiko <<: *logging profiles: - l2_execution_engine - - prover - - proposer taiko_client_driver: image: us-docker.pkg.dev/evmchain/images/taiko-client:taiko-client-v0.39.2 @@ -59,12 +42,15 @@ services: env_file: - .env volumes: - - l2_execution_engine_data:/data/taiko-geth + - l2_execution_engine_data:/data - ./script:/script + - jwt_secret:/data/jwt entrypoint: - /bin/sh - -c - "/script/start-driver.sh" + networks: + - taiko <<: *logging profiles: - l2_execution_engine @@ -84,10 +70,13 @@ services: - .env volumes: - ./script:/script + - jwt_secret:/data/jwt entrypoint: - /bin/sh - -c - "/script/start-prover-relayer.sh" + networks: + - taiko <<: *logging profiles: - prover @@ -102,12 +91,15 @@ services: env_file: - .env volumes: - - l2_execution_engine_data:/data/taiko-geth + - l2_execution_engine_data:/data - ./script:/script + - jwt_secret:/data/jwt entrypoint: - /bin/sh - -c - "/script/start-proposer.sh" + networks: + - taiko <<: *logging profiles: - proposer @@ -126,6 +118,8 @@ services: command: - --log.level=debug - --config.file=/etc/prometheus/prometheus.yml + networks: + - taiko <<: *logging profiles: - l2_execution_engine @@ -149,6 +143,8 @@ services: - ./docker/grafana/custom/settings.ini:/etc/grafana/custom/settings.ini - ./docker/grafana/custom/l2/provisioning/:/etc/grafana/custom/provisioning/ - grafana_data:/var/lib/grafana + networks: + - taiko <<: *logging profiles: - l2_execution_engine @@ -159,3 +155,8 @@ volumes: l2_execution_engine_data: prometheus_data: grafana_data: + jwt_secret: + +networks: + taiko: + name: taiko diff --git a/script/start-driver.sh b/script/start-driver.sh index 8ac2492e..ecbce3fa 100755 --- a/script/start-driver.sh +++ b/script/start-driver.sh @@ -2,6 +2,12 @@ set -eou pipefail +if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then + JWT="/data/jwt/secret" +else + JWT="/data/jwt/secret" +fi + if [ "$DISABLE_P2P_SYNC" = "false" ]; then exec taiko-client driver \ --l1.ws "${L1_ENDPOINT_WS}" \ @@ -10,7 +16,7 @@ if [ "$DISABLE_P2P_SYNC" = "false" ]; then --l2.auth http://l2_execution_engine:8551 \ --taikoL1 "${TAIKO_L1_ADDRESS}" \ --taikoL2 "${TAIKO_L2_ADDRESS}" \ - --jwtSecret /data/taiko-geth/geth/jwtsecret \ + --jwtSecret ${JWT} \ --p2p.sync \ --p2p.checkPointSyncUrl "${P2P_SYNC_URL}" else @@ -21,5 +27,5 @@ else --l2.auth http://l2_execution_engine:8551 \ --taikoL1 "${TAIKO_L1_ADDRESS}" \ --taikoL2 "${TAIKO_L2_ADDRESS}" \ - --jwtSecret /data/taiko-geth/geth/jwtsecret + --jwtSecret ${JWT} fi diff --git a/script/start-l2-execution-engine.sh b/script/start-l2-execution-engine.sh new file mode 100755 index 00000000..09673c85 --- /dev/null +++ b/script/start-l2-execution-engine.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +# Create JWT directory and secret if they don't exist +mkdir -p /data/jwt +if [ ! -f "/data/jwt/secret" ]; then + openssl rand -hex 32 > /data/jwt/secret +fi + +if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then + exec /nethermind/nethermind \ + --config ${NETWORK} \ + --datadir /data/nethermind \ + --JsonRpc.Enabled true \ + --JsonRpc.EnabledModules "Eth, Net, Parity, Personal, Proof, Rpc, Subscribe, Trace, TxPool, Web3, Taiko" \ + --Init.WebSocketsEnabled true \ + --JsonRpc.WebSocketsPort ${PORT_L2_EXECUTION_ENGINE_WS} \ + --JsonRpc.Host 0.0.0.0 \ + --JsonRpc.Port 8545 \ + --Network.DiscoveryPort "${PORT_L2_EXECUTION_ENGINE_P2P}" \ + --Network.P2PPort "${PORT_L2_EXECUTION_ENGINE_P2P}" \ + --JsonRpc.EngineHost 0.0.0.0 \ + --JsonRpc.EnginePort 8551 \ + --Network.MaxActivePeers "${MAXPEERS:-50}" \ + --Metrics.Enabled true \ + --Metrics.ExposePort 6060 \ + --JsonRpc.JwtSecretFile /data/jwt/secret +else + exec taiko-geth \ + --taiko \ + --networkid "${CHAIN_ID}" \ + --gcmode archive \ + --datadir /data/taiko-geth \ + --metrics \ + --metrics.addr "0.0.0.0" \ + --bootnodes ${BOOT_NODES} \ + --authrpc.addr "0.0.0.0" \ + --authrpc.vhosts "*" \ + --authrpc.jwtsecret /data/jwt/secret \ + --http \ + --http.api debug,eth,net,web3,txpool,taiko \ + --http.addr "0.0.0.0" \ + --http.vhosts "*" \ + --ws \ + --ws.api debug,eth,net,web3,txpool,taiko \ + --ws.addr "0.0.0.0" \ + --ws.origins "*" \ + --gpo.defaultprice "10000000" \ + --port ${PORT_L2_EXECUTION_ENGINE_P2P} \ + --discovery.port ${PORT_L2_EXECUTION_ENGINE_P2P} \ + --maxpeers ${MAXPEERS:-50} \ + --maxpendpeers ${MAXPENDPEERS:-0} \ + ${GETH_ADDITIONAL_ARGS:-} +fi diff --git a/script/start-proposer-hekla.sh b/script/start-proposer-hekla.sh index c2aed559..445bd24e 100755 --- a/script/start-proposer-hekla.sh +++ b/script/start-proposer-hekla.sh @@ -2,6 +2,12 @@ set -eou pipefail +if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then + JWT="/nethermind/keystores/jwt-secret" +else + JWT="/taiko-geth/geth/jwtsecret" +fi + if [ "$ENABLE_PROPOSER" = "true" ]; then ARGS="--l1.ws ${L1_ENDPOINT_WS} --l2.http http://l2_execution_engine:8545 @@ -9,7 +15,7 @@ if [ "$ENABLE_PROPOSER" = "true" ]; then --taikoL1 ${TAIKO_L1_ADDRESS} --taikoL2 ${TAIKO_L2_ADDRESS} --taikoToken ${TAIKO_TOKEN_L1_ADDRESS} - --jwtSecret /data/taiko-geth/geth/jwtsecret + --jwtSecret ${JWT} --l1.proposerPrivKey ${L1_PROPOSER_PRIVATE_KEY} --l2.suggestedFeeRecipient ${L2_SUGGESTED_FEE_RECIPIENT}" diff --git a/script/start-proposer.sh b/script/start-proposer.sh index fc5f1fd0..7eee97e8 100755 --- a/script/start-proposer.sh +++ b/script/start-proposer.sh @@ -2,6 +2,12 @@ set -eou pipefail +if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then + JWT="/nethermind/keystores/jwt-secret" +else + JWT="/taiko-geth/geth/jwtsecret" +fi + if [ "$ENABLE_PROPOSER" = "true" ]; then ARGS="--l1.ws ${L1_ENDPOINT_WS} --l2.http http://l2_execution_engine:8545 @@ -9,7 +15,7 @@ if [ "$ENABLE_PROPOSER" = "true" ]; then --taikoL1 ${TAIKO_L1_ADDRESS} --taikoL2 ${TAIKO_L2_ADDRESS} --taikoToken ${TAIKO_TOKEN_L1_ADDRESS} - --jwtSecret /data/taiko-geth/geth/jwtsecret + --jwtSecret ${JWT} --l1.proposerPrivKey ${L1_PROPOSER_PRIVATE_KEY} --l2.suggestedFeeRecipient ${L2_SUGGESTED_FEE_RECIPIENT}" From d8a9507950bc6e2cb16a9df416b97270087befaf Mon Sep 17 00:00:00 2001 From: Marcos Maceo Date: Tue, 17 Dec 2024 15:31:33 +0400 Subject: [PATCH 2/2] feat: add nethermind to hekla --- .env.sample | 15 +++----- .env.sample.hekla | 11 +++++- README.md | 60 ++++++++++++++++++++--------- docker-compose-hekla.yml | 59 ++++++++++++++-------------- docker-compose.yml | 33 ++++++++-------- script/start-driver.sh | 6 --- script/start-l2-execution-engine.sh | 9 +---- script/start-proposer-hekla.sh | 6 --- script/start-proposer.sh | 6 --- 9 files changed, 104 insertions(+), 101 deletions(-) diff --git a/.env.sample b/.env.sample index c7994801..2137f510 100644 --- a/.env.sample +++ b/.env.sample @@ -5,7 +5,7 @@ NETWORK=taiko-mainnet # Exposed ports PORT_L2_EXECUTION_ENGINE_HTTP=8547 -PORT_L2_EXECUTION_ENGINE_WS=8548 +PORT_L2_EXECUTION_ENGINE_WS=8546 PORT_L2_EXECUTION_ENGINE_METRICS=6060 PORT_L2_EXECUTION_ENGINE_P2P=30306 PORT_PROVER_SERVER=9876 @@ -23,15 +23,12 @@ TAIKO_TOKEN_L1_ADDRESS=0x10dea67478c5F8C5E2D90e5E9B26dBe60c54d800 TAIKO_L2_ADDRESS=0x1670000000000000000000000000000000010001 # L2 Execution Engine Configuration -# L2_EXECUTION_ENGINE=taiko-geth -L2_EXECUTION_ENGINE=nethermind +JWT="/data/jwt/secret" # Options: taiko-geth or nethermind -# L2_EXECUTION_ENGINE_IMAGE=us-docker.pkg.dev/evmchain/images/taiko-geth:v1.11.1 -L2_EXECUTION_ENGINE_IMAGE=nethermind/nethermind:1.30.1 -# For Nethermind use: nethermind/nethermind:1.30.1 - -# If using Nethermind, this command will be used instead of the default Geth command -# L2_EXECUTION_ENGINE_START_COMMAND= +L2_EXECUTION_ENGINE=taiko-geth +# L2_EXECUTION_ENGINE=nethermind +L2_EXECUTION_ENGINE_IMAGE=us-docker.pkg.dev/evmchain/images/taiko-geth:v1.11.1 +# L2_EXECUTION_ENGINE_IMAGE=nethermind/nethermind:1.30.1 # P2P DISABLE_P2P_SYNC=false diff --git a/.env.sample.hekla b/.env.sample.hekla index 0058b416..d6af63e5 100644 --- a/.env.sample.hekla +++ b/.env.sample.hekla @@ -5,7 +5,7 @@ NETWORK=taiko-hekla # Exposed ports PORT_L2_EXECUTION_ENGINE_HTTP=8547 -PORT_L2_EXECUTION_ENGINE_WS=8548 +PORT_L2_EXECUTION_ENGINE_WS=8546 PORT_L2_EXECUTION_ENGINE_METRICS=6060 PORT_L2_EXECUTION_ENGINE_P2P=30306 PORT_PROVER_SERVER=9876 @@ -22,6 +22,14 @@ TAIKO_L1_ADDRESS=0x79C9109b764609df928d16fC4a91e9081F7e87DB TAIKO_TOKEN_L1_ADDRESS=0x6490E12d480549D333499236fF2Ba6676C296011 TAIKO_L2_ADDRESS=0x1670090000000000000000000000000000010001 +# L2 Execution Engine Configuration +JWT="/data/jwt/secret" +# Options: taiko-geth or nethermind +L2_EXECUTION_ENGINE=taiko-geth +# L2_EXECUTION_ENGINE=nethermind +L2_EXECUTION_ENGINE_IMAGE=us-docker.pkg.dev/evmchain/images/taiko-geth:v1.11.1 +# L2_EXECUTION_ENGINE_IMAGE=nethermind/nethermind:1.30.1 + # P2P DISABLE_P2P_SYNC=false P2P_SYNC_URL=https://rpc.hekla.taiko.xyz @@ -31,6 +39,7 @@ P2P_SYNC_URL=https://rpc.hekla.taiko.xyz # If you are using a local Holesky L1 node, you can refer to it as "http://host.docker.internal:8545" and "ws://host.docker.internal:8546", which refer to the default ports in the .env for an eth-docker L1 node. # However, you may need to add this host to docker-compose.yml. If that does not work, you can try the private local ip address (e.g. http://192.168.1.15:8545). You can find that with `ip addr show` or a similar command. # In addition, you can use your public ip address followed by the specific ports for http and ws (e.g. http://82.168.1.15:8545). You can find that with `hostname -I | awk '{print $1}'`. +L1_ENDPOINT_HTTP= L1_ENDPOINT_WS= # HTTP RPC endpoint of a L1 beacon node. Everything behind the top-level domain is ignored. Make sure you don't need to work with subdirectories. The path will always be /eth/v1... # If you are using a local Holesky L1 node, you can refer to it as "http://host.docker.internal:5052", which refer to the default REST port in the .env for an eth-docker L1 node. diff --git a/README.md b/README.md index fcfb2ffb..8084002e 100644 --- a/README.md +++ b/README.md @@ -2,33 +2,55 @@ Get started with the [guide](https://docs.taiko.xyz/guides/node-operators/run-a-taiko-node-with-docker/). -## Execution Engine Options +## Setup Instructions -This repository supports two L2 execution engine options: +1. Copy the appropriate .env sample file: + ```bash + # For regular setup + cp .env.sample .env -1. **Taiko-Geth (Default)** - - Use the default `docker-compose.yml` and `.env.sample` - - Command: `docker compose up` + # For Hekla testnet + cp .env.sample.hekla .env + ``` -2. **Nethermind** - - Use `docker-compose-nethermind.yml` and `.env.sample.nethermind` - - Command: `docker compose -f docker-compose-nethermind.yml up` +2. Configure the required L1 endpoints in your `.env` file: + ```env + # L1 endpoints (required) + L1_ENDPOINT_HTTP= # Your L1 HTTP endpoint + L1_ENDPOINT_WS= # Your L1 WebSocket endpoint + L1_BEACON_HTTP= # Your L1 Beacon node HTTP endpoint + ``` -For Hekla testnet: -- Taiko-Geth: Use `docker-compose-hekla.yml` -- Nethermind: Use `docker-compose-nethermind-hekla.yml` + For the L1 Beacon endpoint: + - Local node example: `http://host.docker.internal:5052` + - Remote node example: `http://82.168.1.15:5052` -## Configuration +3. Choose your L2 execution engine in the `.env` file: -1. Copy the appropriate .env sample file: + **Taiko-Geth** + ```env + L2_EXECUTION_ENGINE=taiko-geth + L2_EXECUTION_ENGINE_IMAGE=us-docker.pkg.dev/evmchain/images/taiko-geth:v1.11.1 + ``` + + **Nethermind** + ```env + L2_EXECUTION_ENGINE=nethermind + L2_EXECUTION_ENGINE_IMAGE=nethermind/nethermind:1.30.1 + ``` + +4. Start the node with docker-compose: ```bash - # For Taiko-Geth - cp .env.sample .env + # For regular setup + docker compose up - # For Nethermind - cp .env.sample.nethermind .env + # For Hekla testnet + docker compose -f docker-compose-hekla.yml up ``` -2. Configure your environment variables in the `.env` file. +## Important Notes -3. Start the node with the appropriate docker-compose file for your chosen execution engine. +- The docker-compose configuration is unified for both execution engines +- The JWT secret for the execution engine is automatically managed by a dedicated initialization service +- The L1 beacon node endpoint should be configured with the correct protocol (http/https) and port +- All required endpoints must be properly configured in the `.env` file before starting the node diff --git a/docker-compose-hekla.yml b/docker-compose-hekla.yml index b64b65e1..69232b2b 100644 --- a/docker-compose-hekla.yml +++ b/docker-compose-hekla.yml @@ -5,44 +5,41 @@ x-logging: &logging max-file: "3" services: + jwt_init: + image: alpine + volumes: + - jwt_secret:/data/jwt + command: > + sh -c "mkdir -p /data/jwt && + if [ ! -f /data/jwt/secret ]; then + head -c 32 /dev/urandom | xxd -p -c 32 > /data/jwt/secret; + fi" + profiles: + - l2_execution_engine + l2_execution_engine: - image: us-docker.pkg.dev/evmchain/images/taiko-geth:v1.11.1 + image: ${L2_EXECUTION_ENGINE_IMAGE} restart: unless-stopped pull_policy: always + depends_on: + - jwt_init + env_file: + - .env stop_grace_period: 3m volumes: - - l2_execution_engine_data:/data/taiko-geth + - l2_execution_engine_data:/data + - ./script:/script + - jwt_secret:/data/jwt ports: - "${PORT_L2_EXECUTION_ENGINE_METRICS}:6060" - "${PORT_L2_EXECUTION_ENGINE_HTTP}:8545" - "${PORT_L2_EXECUTION_ENGINE_WS}:8546" - "${PORT_L2_EXECUTION_ENGINE_P2P}:${PORT_L2_EXECUTION_ENGINE_P2P}" - "${PORT_L2_EXECUTION_ENGINE_P2P}:${PORT_L2_EXECUTION_ENGINE_P2P}/udp" - command: | - --taiko - --networkid "${CHAIN_ID}" - --gcmode archive - --datadir /data/taiko-geth - --metrics - --metrics.expensive - --metrics.addr "0.0.0.0" - --bootnodes ${BOOT_NODES} - --authrpc.addr "0.0.0.0" - --authrpc.vhosts "*" - --http - --http.api debug,eth,net,web3,txpool,taiko - --http.addr "0.0.0.0" - --http.vhosts "*" - --ws - --ws.api debug,eth,net,web3,txpool,taiko - --ws.addr "0.0.0.0" - --ws.origins "*" - --gpo.ignoreprice "100000000" - --port ${PORT_L2_EXECUTION_ENGINE_P2P} - --discovery.port ${PORT_L2_EXECUTION_ENGINE_P2P} - --maxpeers ${MAXPEERS:-50} - --maxpendpeers ${MAXPENDPEERS:-0} - ${GETH_ADDITIONAL_ARGS:-} + entrypoint: + - /bin/sh + - -c + - "/script/start-l2-execution-engine.sh" <<: *logging profiles: - l2_execution_engine @@ -58,8 +55,9 @@ services: env_file: - .env volumes: - - l2_execution_engine_data:/data/taiko-geth + - l2_execution_engine_data:/data - ./script:/script + - jwt_secret:/data/jwt entrypoint: - /bin/sh - -c @@ -83,6 +81,7 @@ services: - .env volumes: - ./script:/script + - jwt_secret:/data/jwt entrypoint: - /bin/sh - -c @@ -101,8 +100,9 @@ services: env_file: - .env volumes: - - l2_execution_engine_data:/data/taiko-geth + - l2_execution_engine_data:/data - ./script:/script + - jwt_secret:/data/jwt entrypoint: - /bin/sh - -c @@ -158,3 +158,4 @@ volumes: l2_execution_engine_data: prometheus_data: grafana_data: + jwt_secret: diff --git a/docker-compose.yml b/docker-compose.yml index f0a05b8c..3fcc8bbb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,17 +5,30 @@ x-logging: &logging max-file: "3" services: + jwt_init: + image: alpine + volumes: + - jwt_secret:/data/jwt + command: > + sh -c "mkdir -p /data/jwt && + if [ ! -f /data/jwt/secret ]; then + head -c 32 /dev/urandom | xxd -p -c 32 > /data/jwt/secret; + fi" + profiles: + - l2_execution_engine + l2_execution_engine: image: ${L2_EXECUTION_ENGINE_IMAGE} restart: unless-stopped pull_policy: always + depends_on: + - jwt_init env_file: - .env stop_grace_period: 3m volumes: - l2_execution_engine_data:/data - ./script:/script - - ./script/util/nethermind-config.json:/nethermind/config.json - jwt_secret:/data/jwt ports: - "${PORT_L2_EXECUTION_ENGINE_METRICS}:6060" @@ -27,8 +40,6 @@ services: - /bin/sh - -c - "/script/start-l2-execution-engine.sh" - networks: - - taiko <<: *logging profiles: - l2_execution_engine @@ -49,8 +60,6 @@ services: - /bin/sh - -c - "/script/start-driver.sh" - networks: - - taiko <<: *logging profiles: - l2_execution_engine @@ -75,8 +84,6 @@ services: - /bin/sh - -c - "/script/start-prover-relayer.sh" - networks: - - taiko <<: *logging profiles: - prover @@ -98,8 +105,6 @@ services: - /bin/sh - -c - "/script/start-proposer.sh" - networks: - - taiko <<: *logging profiles: - proposer @@ -118,8 +123,6 @@ services: command: - --log.level=debug - --config.file=/etc/prometheus/prometheus.yml - networks: - - taiko <<: *logging profiles: - l2_execution_engine @@ -143,8 +146,6 @@ services: - ./docker/grafana/custom/settings.ini:/etc/grafana/custom/settings.ini - ./docker/grafana/custom/l2/provisioning/:/etc/grafana/custom/provisioning/ - grafana_data:/var/lib/grafana - networks: - - taiko <<: *logging profiles: - l2_execution_engine @@ -155,8 +156,4 @@ volumes: l2_execution_engine_data: prometheus_data: grafana_data: - jwt_secret: - -networks: - taiko: - name: taiko + jwt_secret: \ No newline at end of file diff --git a/script/start-driver.sh b/script/start-driver.sh index ecbce3fa..28778650 100755 --- a/script/start-driver.sh +++ b/script/start-driver.sh @@ -2,12 +2,6 @@ set -eou pipefail -if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then - JWT="/data/jwt/secret" -else - JWT="/data/jwt/secret" -fi - if [ "$DISABLE_P2P_SYNC" = "false" ]; then exec taiko-client driver \ --l1.ws "${L1_ENDPOINT_WS}" \ diff --git a/script/start-l2-execution-engine.sh b/script/start-l2-execution-engine.sh index 09673c85..eaebe748 100755 --- a/script/start-l2-execution-engine.sh +++ b/script/start-l2-execution-engine.sh @@ -1,11 +1,5 @@ #!/bin/sh -# Create JWT directory and secret if they don't exist -mkdir -p /data/jwt -if [ ! -f "/data/jwt/secret" ]; then - openssl rand -hex 32 > /data/jwt/secret -fi - if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then exec /nethermind/nethermind \ --config ${NETWORK} \ @@ -25,7 +19,7 @@ if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then --Metrics.ExposePort 6060 \ --JsonRpc.JwtSecretFile /data/jwt/secret else - exec taiko-geth \ + exec geth \ --taiko \ --networkid "${CHAIN_ID}" \ --gcmode archive \ @@ -43,6 +37,7 @@ else --ws \ --ws.api debug,eth,net,web3,txpool,taiko \ --ws.addr "0.0.0.0" \ + --ws.port ${PORT_L2_EXECUTION_ENGINE_WS} \ --ws.origins "*" \ --gpo.defaultprice "10000000" \ --port ${PORT_L2_EXECUTION_ENGINE_P2P} \ diff --git a/script/start-proposer-hekla.sh b/script/start-proposer-hekla.sh index 445bd24e..d16ae647 100755 --- a/script/start-proposer-hekla.sh +++ b/script/start-proposer-hekla.sh @@ -2,12 +2,6 @@ set -eou pipefail -if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then - JWT="/nethermind/keystores/jwt-secret" -else - JWT="/taiko-geth/geth/jwtsecret" -fi - if [ "$ENABLE_PROPOSER" = "true" ]; then ARGS="--l1.ws ${L1_ENDPOINT_WS} --l2.http http://l2_execution_engine:8545 diff --git a/script/start-proposer.sh b/script/start-proposer.sh index 7eee97e8..1af47587 100755 --- a/script/start-proposer.sh +++ b/script/start-proposer.sh @@ -2,12 +2,6 @@ set -eou pipefail -if [ "$L2_EXECUTION_ENGINE" = "nethermind" ]; then - JWT="/nethermind/keystores/jwt-secret" -else - JWT="/taiko-geth/geth/jwtsecret" -fi - if [ "$ENABLE_PROPOSER" = "true" ]; then ARGS="--l1.ws ${L1_ENDPOINT_WS} --l2.http http://l2_execution_engine:8545