Skip to content

Commit bd3fe86

Browse files
authored
Merge pull request #297 from yorickdowne/main
PoS-friendly prune Erigon; ethd config sets Geth/Erigon Grafana
2 parents 64cf87d + b5c234b commit bd3fe86

6 files changed

+28
-12
lines changed

default.env

-7
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ EC_WS_PORT=8546
7575
#GETH_CACHE=--cache=256
7676
GETH_CACHE=
7777

78-
# Erigon pruning mode. hrtc is maximum prune; this requires an Infura or other
79-
# 3rd-party temporarily while initial-syncing the consensus client, after which
80-
# Erigon can be used. htc is a partial prune, which doesn't require that dance
81-
# but takes considerably more disk space. Leaving the variable empty would
82-
# configure an archive node.
83-
ERIGON_PRUNE=hrtc
84-
8578
# Restart policy: Set to no if you do not want services to automatically restart
8679
RESTART=unless-stopped
8780
# If you want debug logs, set this to debug instead of info

erigon.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ services:
2121
expose:
2222
- 9090/tcp
2323
entrypoint:
24+
- docker-entrypoint.sh
2425
- erigon
2526
- --private.api.addr
2627
- 0.0.0.0:9090
@@ -32,7 +33,7 @@ services:
3233
- any
3334
- --chain
3435
- ${EC_NETWORK}
35-
- --prune=${ERIGON_PRUNE}
36+
- --prune=hrtc
3637
execution:
3738
restart: "${RESTART}"
3839
image: erigon:local

erigon/Dockerfile.binary

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ ARG UID=10001
99

1010
USER root
1111

12-
RUN apk --no-cache add shadow && groupmod -g "${UID}" erigon && usermod -u "${UID}" -g "${UID}" erigon
12+
RUN apk --no-cache add shadow bash && groupmod -g "${UID}" erigon && usermod -u "${UID}" -g "${UID}" erigon
1313

1414
RUN mkdir -p /var/lib/erigon && chown -R erigon:erigon /var/lib/erigon
1515

16+
COPY ./docker-entrypoint.sh /usr/local/bin/
17+
1618
USER erigon
1719

18-
ENTRYPOINT ["erigon"]
20+
ENTRYPOINT ["docker-entrypoint.sh", "erigon"]

erigon/Dockerfile.source

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FROM alpine:latest
1717
ARG USER=erigon
1818
ARG UID=10001
1919

20-
RUN apk add --no-cache libgcc libstdc++ ca-certificates tzdata
20+
RUN apk add --no-cache libgcc libstdc++ bash ca-certificates tzdata
2121

2222
# See https://stackoverflow.com/a/55757473/12429735RUN
2323
RUN adduser \
@@ -32,7 +32,8 @@ RUN mkdir -p /var/lib/erigon && chown ${USER}:${USER} /var/lib/erigon
3232
# Copy executable
3333
COPY --from=builder /src/erigon/build/bin/erigon /usr/local/bin/
3434
COPY --from=builder /src/erigon/build/bin/rpcdaemon /usr/local/bin/
35+
COPY ./docker-entrypoint.sh /usr/local/bin/
3536

3637
USER ${USER}
3738

38-
ENTRYPOINT ["erigon"]
39+
ENTRYPOINT ["docker-entrypoint.sh", "erigon"]

erigon/docker-entrypoint.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -Eeuo pipefail
3+
4+
# Check for mainnet or goerli, and set prune accordingly
5+
6+
if [[ "$@" =~ "--chain mainnet" ]]; then
7+
echo "mainnet: Running with prune.r.before=11184524 for eth deposit contract"
8+
exec "$@" --prune.r.before=11184524
9+
elif [[ "$@" =~ "--chain goerli" ]]; then
10+
echo "goerli: Running with prune.r.before=4367322 for eth deposit contract"
11+
exec "$@" --prune.r.before=4367322
12+
else
13+
echo "Unable to determine eth deposit contract, running without prune.r.before"
14+
exec "$@"
15+
fi

ethd

+4
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ query_execution_client() {
323323
"Which execution client do you want to run? Choose Custom for 3rd parties like Infura" 15 60 6 \
324324
"NONE" "Custom" \
325325
"geth.yml" "Geth (Go)" \
326+
"erigon.yml" "Erigon (Go)" \
326327
"nm.yml" "Nethermind (.NET)" \
327328
"besu.yml" "Besu (Java)" 3>&1 1>&2 2>&3)
328329
fi
@@ -359,6 +360,9 @@ query_execution_client() {
359360
query_grafana() {
360361
if (whiptail --title "Select Option" --yesno --defaultno "Do you want to use Grafana dashboards?" 10 60) then
361362
GRAFANA_CLIENT=$(echo $(echo "${CONSENSUS_CLIENT}" | cut -d '-' -f1)-grafana.yml:grafana-insecure.yml)
363+
if [[ ${EXECUTION_CLIENT} == "geth.yml" || ${EXECUTION_CLIENT} == "erigon.yml" ]]; then
364+
GRAFANA_CLIENT=${GRAFANA_CLIENT}:$(echo $(echo "${EXECUTION_CLIENT}" | cut -d '.' -f1)-grafana.yml)
365+
fi
362366
else
363367
unset GRAFANA_CLIENT
364368
fi

0 commit comments

Comments
 (0)