Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions beacon-chain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG UPSTREAM_VERSION

FROM ghcr.io/gnosischain/gnosis-nimbus-eth2:${UPSTREAM_VERSION}

ARG NETWORK
ARG STAKER_SCRIPTS_VERSION
ARG DATA_DIR
ARG P2P_PORT

ENV JWT_FILE_PATH=/jwtsecret.hex \
VALIDATOR_PORT=3500 \
DATA_DIR=${DATA_DIR} \
P2P_PORT=${P2P_PORT} \
NIMBUS_BIN="/home/user/nimbus_beacon_node" \
STAKER_SCRIPTS_URL=https://github.com/dappnode/staker-package-scripts/releases/download/${STAKER_SCRIPTS_VERSION}

COPY entrypoint.sh /usr/local/bin/entrypoint.sh

ADD ${STAKER_SCRIPTS_URL}/consensus_tools.sh /etc/profile.d/

USER root

RUN apt-get update && apt-get --yes install curl && apt-get clean && \
chmod +rx /usr/local/bin/entrypoint.sh /etc/profile.d/consensus_tools.sh

# This env changes the variant
# Placed at the end to regenerate the least amount of layers
ENV NETWORK=${NETWORK}

ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
62 changes: 62 additions & 0 deletions beacon-chain/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/sh


# shellcheck disable=SC1091 # Path is relative to the Dockerfile
. /etc/profile

ENGINE_URL="http://execution.${NETWORK}.staker.dappnode:8551"
VALID_FEE_RECIPIENT=$(get_valid_fee_recipient "${FEE_RECIPIENT_ADDRESS}")

JWT_SECRET=$(get_jwt_secret_by_network "${NETWORK}")
touch "${JWT_FILE_PATH}"
echo "${JWT_SECRET}" >"${JWT_FILE_PATH}"

# Ensure the removal of ${DATA_DIR}/validators if it exists
if [ -d "${DATA_DIR}/validators" ]; then
echo "[INFO - entrypoint] Found existing validators directory at ${DATA_DIR}/validators. Removing it."
if rm -rf "${DATA_DIR}/validators"; then
echo "[INFO - entrypoint] Successfully removed ${DATA_DIR}/validators."
else
echo "[ERROR - entrypoint] Failed to remove ${DATA_DIR}/validators. Exiting."
exit 1
fi
else
echo "[INFO - entrypoint] No validators directory found. Proceeding."
fi

if [ -n "$(ls -A "${DATA_DIR}/db" 2>/dev/null)" ]; then
echo "[INFO - entrypoint] Data directory has already been initialized, skipping checkpoint sync."

elif [ -n "${CHECKPOINT_SYNC_URL}" ]; then
echo "[INFO - entrypoint] Running checkpoint sync script"

${NIMBUS_BIN} trustedNodeSync \
--network="${NETWORK}" \
--trusted-node-url="${CHECKPOINT_SYNC_URL}" \
--backfill=false \
--data-dir="${DATA_DIR}"

else
echo "[WARN - entrypoint] No checkpoint sync script provided. Syncing from genesis."
fi

FLAGS="--network=$NETWORK \
--data-dir=$DATA_DIR \
--tcp-port=$P2P_PORT \
--udp-port=$P2P_PORT \
--log-level=$LOG_TYPE \
--rest \
--rest-port=3500 \
--rest-address=0.0.0.0 \
--metrics \
--metrics-address=0.0.0.0 \
--metrics-port=8008 \
--jwt-secret=$JWT_FILE_PATH \
--web3-url=$ENGINE_URL \
--rest-allow-origin=$CORS \
--suggested-fee-recipient=$VALID_FEE_RECIPIENT $EXTRA_OPTS"

echo "[INFO - entrypoint] Starting beacon with flags: $FLAGS"

# shellcheck disable=SC2086
exec ${NIMBUS_BIN} $FLAGS
12 changes: 0 additions & 12 deletions build/Dockerfile

This file was deleted.

62 changes: 0 additions & 62 deletions build/entrypoint.sh

This file was deleted.

1 change: 0 additions & 1 deletion build/jwtsecret.hex

This file was deleted.

61 changes: 34 additions & 27 deletions dappnode_package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
{
"name": "nimbus-gnosis.dnp.dappnode.eth",
"version": "0.1.2",
"upstreamVersion": "v25.4.0",
"upstreamRepo": "status-im/nimbus-eth2",
"upstreamArg": "UPSTREAM_VERSION",
"architectures": ["linux/amd64"],
"version": "0.1.4",
"links": {
"ui": "http://brain.web3signer-gnosis.dappnode",
"homepage": "https://nimbus.team/",
"readme": "https://github.com/dappnode/DAppNodePackage-nimbus-generic",
"docs": "https://nimbus.guide"
},
"upstream": [
{
"repo": "status-im/nimbus-eth2",
"version": "v25.9.2",
"arg": "UPSTREAM_VERSION"
},
{
"repo": "dappnode/staker-package-scripts",
"version": "v0.1.2",
"arg": "STAKER_SCRIPTS_VERSION"
}
],
"architectures": ["linux/amd64", "linux/arm64"],
"shortDescription": "Nimbus ETH2.0 Beacon chain + validator",
"description": "Nimbus is a client implementation that strives to be as lightweight as possible in terms of resources used. This allows it to perform well on embedded systems, resource-restricted devices -- including Raspberry Pis and mobile devices -- and multi-purpose servers.",
"type": "service",
"author": "DAppNode Association <admin@dappnode.io> (https://github.com/dappnode)",
"contributors": [
"pablo <pablo@dappnode.io> (https://github.com/pablomendezroyo)",
"marce <mgarciate@dappnode.io> (https://github.com/mgarciate)",
"filoozom <philippe.schommers@gnosis.pm> (https://github.com/filoozom)"
"pablo <pablo@dappnode.io> (https://github.com/pablomendezroyo)"
],
"license": "GPL-3.0",
"repository": {
Expand All @@ -22,28 +35,22 @@
"bugs": {
"url": "https://github.com/dappnode/DAppNodePackage-nimbus-gnosis/issues"
},
"requirements": {
"minimumDappnodeVersion": "0.2.89"
},
"categories": ["Blockchain"],
"links": {
"ui": "http://brain.web3signer-gnosis.dappnode",
"homepage": "https://nimbus.team/",
"readme": "https://github.com/dappnode/DAppNodePackage-nimbus-gnosis",
"docs": "https://nimbus.guide"
},
"categories": ["Blockchain", "ETH2.0"],
"chain": {
"driver": "ethereum-beacon-chain",
"serviceName": "beacon-validator",
"portNumber": 4500
"serviceName": "beacon-chain",
"portNumber": 3500
},
"warnings": {
"onRemove": "Make sure your StakersUI does not have this client selected! Double check in the Stakers Tab in the left NavBar"
"onRemove": "Make sure your StakersUI does not have this client selected! Double check in the Stakers Tab in the left NavBar",
"onMajorUpdate": "This major update requires you to reconfigure your previous settings."
},
"globalEnvs": [
{
"envs": ["EXECUTION_CLIENT_GNOSIS"],
"services": ["beacon-validator"]
}
]
"requirements": {
"minimumDappnodeVersion": "0.3.11"
},
"optionalDependencies": {
"gnosis-erigon.dnp.dappnode.eth": ">=1.0.2",
"nethermind-xdai.dnp.dappnode.eth": ">=1.0.69",
"web3signer-gnosis.dnp.dappnode.eth": ">=1.0.14"
}
}
51 changes: 40 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,53 @@ version: "3.6"
services:
beacon-validator:
build:
context: ./build
context: proxy
args:
UPSTREAM_VERSION: v25.4.0
restart: unless-stopped
stop_grace_period: 1m
NETWORK: gnosis
depends_on:
- beacon-chain
- validator
beacon-chain:
build:
context: beacon-chain
args:
UPSTREAM_VERSION: v25.9.2
STAKER_SCRIPTS_VERSION: v0.1.2
NETWORK: gnosis
P2P_PORT: 9706
DATA_DIR: /home/user/nimbus-eth2/build/data
environment:
LOG_TYPE: INFO
GRAFFITI: validating_from_DAppNode
P2P_TCP_PORT: 9206
P2P_UDP_PORT: 9206
FEE_RECIPIENT_ADDRESS: ""
CHECKPOINT_SYNC_URL: ""
CORS: "*"
EXTRA_OPTS: ""
FEE_RECIPIENT_ADDRESS: ""
ports:
- 9206:9206/tcp
- 9206:9206/udp
- 9706:9706/tcp
- 9706:9706/udp
volumes:
- nimbus-data:/home/user/nimbus-eth2/build/data
image: beacon-validator.nimbus-gnosis.dnp.dappnode.eth:0.1.0
restart: unless-stopped
stop_grace_period: 1m
validator:
build:
context: validator
args:
UPSTREAM_VERSION: v25.9.2
STAKER_SCRIPTS_VERSION: v0.1.2
NETWORK: gnosis
DATA_DIR: /home/user/nimbus-eth2/build/data
environment:
LOG_TYPE: INFO
GRAFFITI: validating_from_DAppNode
FEE_RECIPIENT_ADDRESS: ""
ENABLE_DOPPELGANGER: "true"
EXTRA_OPTS: ""
BACKUP_BEACON_NODES: ""
volumes:
- nimbus-validators-data:/home/user/nimbus-eth2/build/data
restart: unless-stopped
stop_grace_period: 1m
volumes:
nimbus-data: {}
nimbus-validators-data: {}
Loading