-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathdocker-compose.eth.yml
127 lines (123 loc) · 4.67 KB
/
docker-compose.eth.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
version: '3.9'
services:
#########################################################################
# ethereum/client-go
# - https://github.com/ethereum/go-ethereum/wiki/Running-in-Docker
#------------------------------------------------------------------------
# Example of commands to container
# - Use console inside container
# 1. $ docker compose -f docker-compose.eth.yml exec geth sh
# 2. # geth attach or geth attach ipc://root/.ethereum/goerli/geth.ipc
# 3. > eth.syncing
# - Call JSON-RPC (https://eth.wiki/json-rpc/API)
# $ curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545
# - [WIP] Use console outside container
# $ geth attach ./docker/nodes/eth/sepolia/geth.ipc => not working yet
# $ geth attach ipc:./docker/nodes/eth/sepolia/geth.ipc => not working yet
# $ docker exec -it geth geth attach ipc://root/.ethereum/goerli/geth.ipc => it works
#########################################################################
geth:
# https://hub.docker.com/r/ethereum/client-go/
image: built-client-go:${GETH_VERSION:-latest}
build:
context: .
dockerfile: ./docker/nodes/eth/Dockerfile.geth
args:
- VERSION=${GETH_VERSION:-latest}
container_name: ${TARGET_NETWORK}-geth
volumes:
- ./docker/nodes/eth/${TARGET_NETWORK}:/data
- ./docker/nodes/eth/configs/jwtsecret:/secret/jwtsecret
ports:
#- "8551:8551" # Authorization Port
- ${GETH_HTTP_PORT:-8545}:${GETH_HTTP_PORT:-8545} # RPC Port
- 0.0.0.0:30303:30303/tcp
- 0.0.0.0:30303:30303/udp
#stdin_open: true
#tty: true
command:
- --${TARGET_NETWORK} # network. e.g. sepolia
- --networkid=11155111
- --datadir=/data
- --http
- --http.api=web3,eth,net,admin
- --http.addr=0.0.0.0
- --http.port=${GETH_HTTP_PORT:-8545}
- --http.vhosts=*
- --http.corsdomain=*
- --authrpc.addr=0.0.0.0
- --authrpc.port=8551
- --authrpc.vhosts=*
- --authrpc.jwtsecret=/secret/jwtsecret
- --port=30303
- --maxpeers=100
- --cache=4096
#- --verbosity=4
networks:
eth:
healthcheck:
test: [ "CMD", "curl", "-X", "POST", "-H", "'Content-Type: application/json'", "--data", '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false]}', "http://127.0.0.1:${GETH_HTTP_PORT:-8545}" ]
interval: "5s"
timeout: "10s"
retries: 10
# Apple Silicon MacOS would not be run
# - https://github.com/ChainSafe/lodestar/issues/4801
# lodestar version must be v1.4.0-rc.1 or higher
lodestar:
# https://hub.docker.com/r/chainsafe/lodestar
image: "chainsafe/lodestar:${LODESTAR_VERSION:-latest}"
container_name: ${TARGET_NETWORK}-lodestar
volumes:
- ./docker/nodes/eth/${TARGET_NETWORK}:/data
- ./docker/nodes/eth/configs/jwtsecret:/secret/jwtsecret
ports:
- ${BEACON_HTTP_PORT:-9596}:${BEACON_HTTP_PORT:-9596} # REST API port
- 0.0.0.0:9000:9000/tcp
- 0.0.0.0:9000:9000/udp
environment:
NODE_OPTIONS: --max-old-space-size=4096
command:
- beacon
- --checkpointSyncUrl=${CHECKPOINT_SYNC_URL}
- --network=${TARGET_NETWORK}
- --dataDir=/data/lodestar
- --eth1=true
- --eth1.providerUrls=http://${TARGET_NETWORK}-geth:${GETH_HTTP_PORT}
- --execution.urls=http://${TARGET_NETWORK}-geth:8551
- --rest.address=0.0.0.0
- --rest.namespace='*'
- --jwt-secret=/secret/jwtsecret
- --targetPeers=50
#- --logLevel=debug
- --logFile=/data/lodestar/beacon.log
#- --logFileLevel=debug
- --logFileDailyRotate=5
depends_on:
geth:
condition: service_healthy
networks:
eth:
#########################################################################
# trufflesuite/ganache-cli
# - https://hub.docker.com/r/trufflesuite/ganache-cli
#------------------------------------------------------------------------
# Example of commands to container
# - run
# $ docker compose -f docker-compose.eth.yml up ganache
# - cli command example
# $ ganache-cli --mnemonic "toy echo orbit embrace opinion file client report history bomb regret life"
#
ganache:
image: trufflesuite/ganache-cli:v6.12.2
container_name: ganache
ports:
- "${ETH_RPC_PORT:-8545}:8545"
volumes:
- ./docker/nodes/eth/ganache-data:/ganache_data
# command adds into default ENTRYPOINT
# https://hub.docker.com/r/trufflesuite/ganache-cli/dockerfile
command: --mnemonic "toy echo orbit embrace opinion file client report history bomb regret life"
networks:
eth:
name: eth
driver: bridge