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

Commit

Permalink
Merge pull request #42 from primevprotocol/revert-41-iowar/docker.0
Browse files Browse the repository at this point in the history
Revert "fix: multiple docker builder searcher support"
  • Loading branch information
kant777 authored Oct 8, 2023
2 parents af975f7 + 7118316 commit 2239981
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,26 @@ echo "Node Type: $NODE_TYPE"
# Define paths
KEY_PATH="/keys"
CONFIG_PATH="/config"
IP=$(ifconfig eth0|grep inet|awk -F" " '{print $2}'|cut -d":" -f2)

# Check whether the private key file based on node type already exists
if [ "$NODE_TYPE" = "bootnode" ]; then
PRIV_KEY_FILE="${KEY_PATH}/bootnode"
CONFIG_FILE="${CONFIG_PATH}/bootnode.yml"
elif [ "$NODE_TYPE" = "builder" ]; then
PRIV_KEY_FILE="${KEY_PATH}/builder${IP}"
CONFIG_FILE="${CONFIG_PATH}/builder${IP}.yml"

if [ ! -f "$CONFIG_FILE" ]; then
cd $CONFIG_PATH
cp builder.yml builder${IP}.yml
cd -
fi
PRIV_KEY_FILE="${KEY_PATH}/builder"
CONFIG_FILE="${CONFIG_PATH}/builder.yml"
else
PRIV_KEY_FILE="${KEY_PATH}/searcher${IP}"
CONFIG_FILE="${CONFIG_PATH}/searcher${IP}.yml"

if [ ! -f "$CONFIG_FILE" ]; then
cd $CONFIG_PATH
cp searcher.yml searcher${IP}.yml
cd -
fi

PRIV_KEY_FILE="${KEY_PATH}/searcher"
CONFIG_FILE="${CONFIG_PATH}/searcher.yml"
fi


if [ "$NODE_TYPE" != "bootnode" ]; then
# Generate the private key based on node type only if it doesn't exist yet
if [ ! -f "$PRIV_KEY_FILE" ]; then
/app/mev-commit create-key ${PRIV_KEY_FILE}
# Update the private key path in the configuration
sed -i "s|priv_key_file:.*|priv_key_file: ${PRIV_KEY_FILE}|" ${CONFIG_FILE}
fi

if [ "$NODE_TYPE" == "bootnode" ] && [ ! -f "$PRIV_KEY_FILE" ];then
/app/mev-commit create-key ${PRIV_KEY_FILE}
# Update the private key path in the configuration
sed -i "s|priv_key_file:.*|priv_key_file: ${PRIV_KEY_FILE}|" ${CONFIG_FILE}
else
echo "Key file ${PRIV_KEY_FILE} already exists. Skipping key creation."
fi

# If this is not the bootnode, update the bootnodes entry with P2P ID
Expand Down

0 comments on commit 2239981

Please sign in to comment.