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
22 changes: 2 additions & 20 deletions base-consensus-entrypoint
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
#!/bin/bash
set -eu

get_public_ip() {
# Define a list of HTTP-based providers
local PROVIDERS=(
"http://ifconfig.me"
"http://api.ipify.org"
"http://ipecho.net/plain"
"http://v4.ident.me"
)
# Iterate through the providers until an IP is found or the list is exhausted
for provider in "${PROVIDERS[@]}"; do
local IP
IP=$(curl -s --max-time 10 --connect-timeout 5 "$provider")
# Check if IP contains a valid format (simple regex for an IPv4 address)
if [[ $IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "$IP"
return 0
fi
done
return 1
}
# shellcheck source=helpers.sh
source "$(dirname "$0")/helpers.sh"

if [[ -z "${BASE_NODE_NETWORK:-}" ]]; then
echo "expected BASE_NODE_NETWORK to be set" 1>&2
Expand Down
3 changes: 2 additions & 1 deletion geth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FROM ubuntu:24.04

RUN apt-get update && \
apt-get install -y jq curl supervisor && \
rm -rf /var/lib/apt/lists
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/log/supervisor

WORKDIR /app
Expand All @@ -38,6 +38,7 @@ COPY --from=op /app/op-node/bin/op-node ./
COPY --from=geth /app/build/bin/geth ./
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY geth/geth-entrypoint ./execution-entrypoint
COPY helpers.sh .
COPY op-node-entrypoint .
COPY consensus-entrypoint .

Expand Down
23 changes: 23 additions & 0 deletions helpers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Shared helper functions for consensus entrypoints

get_public_ip() {
# Define a list of HTTP-based providers
local PROVIDERS=(
"http://ifconfig.me"
"http://api.ipify.org"
"http://ipecho.net/plain"
"http://v4.ident.me"
)
# Iterate through the providers until an IP is found or the list is exhausted
for provider in "${PROVIDERS[@]}"; do
local IP
IP=$(curl -s --max-time 10 --connect-timeout 5 "$provider")
# Check if IP contains a valid format (simple regex for an IPv4 address)
if [[ $IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "$IP"
return 0
fi
done
return 1
}
1 change: 1 addition & 0 deletions nethermind/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ COPY --from=build /publish ./
COPY --from=op /app/op-node/bin/op-node ./
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY nethermind/nethermind-entrypoint ./execution-entrypoint
COPY helpers.sh .
COPY op-node-entrypoint .
COPY consensus-entrypoint .

Expand Down
22 changes: 2 additions & 20 deletions op-node-entrypoint
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
#!/bin/bash
set -eu

get_public_ip() {
# Define a list of HTTP-based providers
local PROVIDERS=(
"http://ifconfig.me"
"http://api.ipify.org"
"http://ipecho.net/plain"
"http://v4.ident.me"
)
# Iterate through the providers until an IP is found or the list is exhausted
for provider in "${PROVIDERS[@]}"; do
local IP
IP=$(curl -s --max-time 10 --connect-timeout 5 "$provider")
# Check if IP contains a valid format (simple regex for an IPv4 address)
if [[ $IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "$IP"
return 0
fi
done
return 1
}
# shellcheck source=helpers.sh
source "$(dirname "$0")/helpers.sh"

if [[ -z "$OP_NODE_NETWORK" && -z "$OP_NODE_ROLLUP_CONFIG" ]]; then
echo "expected OP_NODE_NETWORK to be set" 1>&2
Expand Down
1 change: 1 addition & 0 deletions reth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ COPY --from=reth-base /app/target/maxperf/base-consensus ./
COPY --from=reth-base /app/target/maxperf/base-reth-node ./
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./reth/reth-entrypoint ./execution-entrypoint
COPY helpers.sh .
COPY op-node-entrypoint .
COPY base-consensus-entrypoint .
COPY consensus-entrypoint .
Expand Down