From d192f94012a685f513c5d85a5134df69bb70c81a Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Tue, 29 Oct 2024 17:03:58 -0700 Subject: [PATCH] chore: add docker setup for reth --- README.md | 7 +++++ docker/docker-compose.yml | 57 +++++++++++++++++++++++++++++++++++++++ docker/jwttoken/jwt.hex | 1 + 3 files changed, 65 insertions(+) create mode 100644 README.md create mode 100755 docker/docker-compose.yml create mode 100644 docker/jwttoken/jwt.hex diff --git a/README.md b/README.md new file mode 100644 index 0000000..62787e3 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +## Development + +```bash +$ cd docker +$ docker compose up -d +$ docker compose down +``` diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100755 index 0000000..26853c8 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,57 @@ +name: "reth" + +services: + jwt-init: + container_name: jwt-init + image: alpine + volumes: + - ./jwttoken:/jwt + command: > + /bin/sh -c "mkdir -p /jwt && + if [ ! -f /jwt/jwt.hex ]; then + apk add --no-cache openssl && + openssl rand -hex 32 | tr -d '\n' > /jwt/jwt.hex && + echo '✅ JWT token generated successfully'; + else + echo '✅ JWT token already exists'; + fi" + + reth: + container_name: reth + restart: unless-stopped + image: ghcr.io/paradigmxyz/reth + depends_on: + jwt-init: + condition: service_completed_successfully + ports: + - "9001:9001" # metrics + - "30303:30303" # eth/66 peering + - "8545:8545" # rpc + - "8551:8551" # engine + volumes: + - mainnet_data:/root/.local/share/reth/mainnet + - sepolia_data:/root/.local/share/reth/sepolia + - holesky_data:/root/.local/share/reth/holesky + - logs:/root/logs + - ./jwttoken:/root/jwt:ro + pid: host + command: > + node + --chain sepolia + --metrics 0.0.0.0:9001 + --log.file.directory /root/logs + --authrpc.addr 0.0.0.0 + --authrpc.port 8551 + --authrpc.jwtsecret /root/jwt/jwt.hex + --http --http.addr 0.0.0.0 --http.port 8545 + --http.api "eth,net,web3" + +volumes: + mainnet_data: + driver: local + sepolia_data: + driver: local + holesky_data: + driver: local + logs: + driver: local diff --git a/docker/jwttoken/jwt.hex b/docker/jwttoken/jwt.hex new file mode 100644 index 0000000..6570be3 --- /dev/null +++ b/docker/jwttoken/jwt.hex @@ -0,0 +1 @@ +dba4fde66a8c385e6e96d649ee3c651e923d283cf342d66059447e1079dc737c