Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
feat: supports holesky and sepolia testnets
Browse files Browse the repository at this point in the history
  • Loading branch information
islishude committed Dec 4, 2023
1 parent 51e1ee4 commit 8a07257
Show file tree
Hide file tree
Showing 12 changed files with 548 additions and 6 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Geth Docker

## For Production
## Use the docker image

### docker-compose
```
docker run --rm ghcr.io/islishude/geth:latest --help
```

## Mainnet

### Run mainnet node with docker-compose

Create storage directories

Expand All @@ -19,15 +25,15 @@ Start for mainnet
$ docker-compose up -d
```

### Kubernetes
### Run mainnet node with kubernetes

Create a storage class like following

```yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ebs-gp3 # change it!
name: ebs-gp3
parameters:
csi.storage.k8s.io/fstype: xfs
encrypted: "false"
Expand All @@ -47,6 +53,11 @@ Start the statefulset in default namespace, you can add `-n` parameter to change
kubectl apply -k k8s
```
## Testnet
- [holesky](./testnet/holeksy/docker-compose.yml)
- [sepolia](./testnet/sepolia/docker-compose.yml)
## For Development
- [Private Networks](https://geth.ethereum.org/docs/interface/private-network)
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ version: "3.8"
services:
geth:
image: ethereum/client-go:v1.13.5
container_name: geth
restart: unless-stopped
ports:
- 30303:30303
Expand Down Expand Up @@ -39,7 +38,6 @@ services:
max-file: 10
prysm:
image: gcr.io/prysmaticlabs/prysm/beacon-chain:v4.1.1
container_name: prysm
restart: unless-stopped
stop_grace_period: 2m
volumes:
Expand Down
74 changes: 74 additions & 0 deletions testnet/holeksy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
version: "3.8"

services:
geth:
image: ethereum/client-go:v1.13.5
restart: unless-stopped
ports:
- 30303:30303
- 30303:30303/udp
- 8545:8545
- 8546:8546
volumes:
- ./data/geth:/data
stop_grace_period: 2m
healthcheck:
test: ["CMD-SHELL", "geth attach --datadir /data --exec eth.blockNumber"]
interval: 10s
timeout: 5s
retries: 5
command:
- --holesky
- --datadir=/data
- --http
- --http.api=eth,net,web3
- --http.addr=0.0.0.0
- --http.vhosts=*
- --http.corsdomain=*
- --ws
- --ws.origins=*
- --ws.addr=0.0.0.0
- --ws.api=eth,net,web3
- --graphql
- --graphql.corsdomain=*
- --graphql.vhosts=*
logging:
driver: json-file
options:
max-size: 2m
max-file: 10
genesis:
image: alpine:latest
restart: on-failure
entrypoint: ["sh", "-c"]
command:
- "if [ ! -f genesis.ssz ]; then wget 'https://github.com/eth-clients/holesky/raw/main/custom_config_data/genesis.ssz'; fi"
working_dir: /genesis
volumes:
- ./data/genesis:/genesis
prysm:
image: gcr.io/prysmaticlabs/prysm/beacon-chain:v4.1.1
restart: unless-stopped
stop_grace_period: 2m
volumes:
- ./data/prysm:/data
- ./data/geth:/geth
- ./data/genesis:/genesis
depends_on:
geth:
condition: service_healthy
genesis:
condition: service_completed_successfully
command:
- --accept-terms-of-use
- --holesky
- --datadir=/data
- --execution-endpoint=/geth/geth.ipc
- --genesis-state=/genesis/genesis.ssz
- --checkpoint-sync-url=https://holesky.beaconstate.info
- --genesis-beacon-api-url=https://holesky.beaconstate.info
logging:
driver: json-file
options:
max-size: 2m
max-file: 10
11 changes: 11 additions & 0 deletions testnet/holeksy/k8s/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- pvc.yaml
- service.yaml
- statefulset.yaml
images:
- name: ethereum/go-client
newTag: v1.13.5
- name: gcr.io/prysmaticlabs/prysm/beacon-chain
newTag: v4.1.1
25 changes: 25 additions & 0 deletions testnet/holeksy/k8s/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: chaindata-geth
spec:
storageClassName: default # change it!
resources:
requests:
storage: 100Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: chaindata-prysm
spec:
storageClassName: default # change it!
resources:
requests:
storage: 50Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
33 changes: 33 additions & 0 deletions testnet/holeksy/k8s/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: v1
kind: Service
metadata:
name: geth
spec:
ports:
- protocol: TCP
targetPort: 8545
port: 8545
name: http
- protocol: TCP
targetPort: 8546
port: 8546
name: websocket
selector:
app: ethereum
---
apiVersion: v1
kind: Service
metadata:
name: prysm
spec:
ports:
- protocol: TCP
targetPort: 4000
port: 4000
name: grpc
- protocol: TCP
targetPort: 3500
port: 3500
name: jsonrpc
selector:
app: ethereum
122 changes: 122 additions & 0 deletions testnet/holeksy/k8s/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ethereum
spec:
selector:
matchLabels:
app: ethereum
replicas: 1
serviceName: ethereum
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: ethereum
spec:
terminationGracePeriodSeconds: 300
initContainers:
- name: genesis
iamge: alpine
command: ["sh", "-c"]
args: ["if [ ! -f genesis.ssz ]; then wget 'https://github.com/eth-clients/holesky/raw/main/custom_config_data/genesis.ssz'; fi"]
workingDir: "/data"
volumeMounts:
- name: prysm
mountPath: /data
containers:
- name: geth
image: ethereum/client-go
ports:
- containerPort: 8545
- containerPort: 8546
- { containerPort: 30303, protocol: TCP }
- { containerPort: 30303, protocol: UDP }
args:
- --holesky
- --datadir=/data
- --http
- --http.api=eth,net,web3
- --http.addr=0.0.0.0
- --http.vhosts=*
- --http.corsdomain=*
- --ws
- --ws.origins=*
- --ws.addr=0.0.0.0
- --ws.api=eth,net,web3
- --graphql
- --graphql.corsdomain=*
- --graphql.vhosts=*
resources:
requests:
memory: 2G
cpu: 1000m
limits:
memory: 16G
cpu: 8000m
livenessProbe:
httpGet:
path: /
port: 8545
readinessProbe:
httpGet:
path: /
port: 8545
volumeMounts:
- name: geth
mountPath: /data
- name: beacon
image: gcr.io/prysmaticlabs/prysm/beacon-chain
args:
- --holesky
- --accept-terms-of-use
- --datadir=/data
- --execution-endpoint=/geth/geth.ipc
- --genesis-state=/data/genesis.ssz
- --checkpoint-sync-url=https://holesky.beaconstate.info
- --genesis-beacon-api-url=https://holesky.beaconstate.info
- --rpc-host=0.0.0.0
- --rpc-port=4000
- --grpc-gateway-corsdomain=*
- --grpc-gateway-host=0.0.0.0
- --grpc-gateway-port=3500
ports:
- containerPort: 4000
name: grpc
- containerPort: 3500
name: jsonrpc
- containerPort: 13000
name: p2ptcp
- containerPort: 12000
protocol: UDP
name: p2pudp
readinessProbe:
tcpSocket:
port: 4000
livenessProbe:
tcpSocket:
port: 4000
startupProbe:
failureThreshold: 60
tcpSocket:
port: 4000
resources:
limits:
cpu: 8000m
memory: 16G
requests:
cpu: 1000m
memory: 4G
volumeMounts:
- name: prysm
mountPath: /data
- name: geth
mountPath: /geth
volumes:
- name: geth
persistentVolumeClaim:
claimName: chaindata-geth
- name: prysm
persistentVolumeClaim:
claimName: chaindata-prysm
Loading

0 comments on commit 8a07257

Please sign in to comment.