2023-10-16 10:59:05 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Set env variables for nomos-node.
|
2023-10-30 14:51:40 +00:00
|
|
|
NET_NODE_KEY=$(/etc/nomos/scripts/register_node.sh)
|
2023-10-16 10:59:05 +00:00
|
|
|
CONSENSUS_PRIV_KEY=$NET_NODE_KEY
|
2023-11-09 10:59:06 +00:00
|
|
|
DA_VOTER=$CONSENSUS_PRIV_KEY
|
2023-10-30 14:51:40 +00:00
|
|
|
OVERLAY_NODES=$(/etc/nomos/scripts/consensus_node_list.sh)
|
2023-10-16 10:59:05 +00:00
|
|
|
|
|
|
|
node_ids=$(etcdctl get "/node/" --prefix --keys-only)
|
|
|
|
for node_id in $node_ids; do
|
|
|
|
node_key=$(etcdctl get "/config${node_id}/key" --print-value-only)
|
|
|
|
node_ip=$(etcdctl get "/config${node_id}/ip" --print-value-only)
|
|
|
|
node_multiaddr="/ip4/${node_ip}/tcp/3000"
|
|
|
|
|
2023-10-30 14:51:40 +00:00
|
|
|
if [ -z "$NET_INITIAL_PEERS" ]; then
|
2023-10-16 10:59:05 +00:00
|
|
|
NET_INITIAL_PEERS=$node_multiaddr
|
|
|
|
else
|
|
|
|
NET_INITIAL_PEERS="${NET_INITIAL_PEERS},${node_multiaddr}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
export CONSENSUS_PRIV_KEY \
|
2023-11-09 10:59:06 +00:00
|
|
|
DA_VOTER \
|
2023-10-16 10:59:05 +00:00
|
|
|
OVERLAY_NODES \
|
|
|
|
NET_NODE_KEY \
|
|
|
|
NET_INITIAL_PEERS
|
|
|
|
|
|
|
|
echo "I am a container ${HOSTNAME} node ${NET_NODE_KEY}"
|
2023-10-30 14:51:40 +00:00
|
|
|
echo "CONSENSUS_PRIV_KEY: ${CONSENSUS_PRIV_KEY}"
|
2023-11-09 10:59:06 +00:00
|
|
|
echo "DA_VOTER: ${DA_VOTER}"
|
2023-10-30 14:51:40 +00:00
|
|
|
echo "OVERLAY_NODES: ${OVERLAY_NODES}"
|
|
|
|
echo "NET_INITIAL_PEERS: ${NET_INITIAL_PEERS}"
|
2023-10-16 10:59:05 +00:00
|
|
|
|
|
|
|
exec /usr/bin/nomos-node /etc/nomos/libp2p_config.yaml
|