diff --git a/berachain-artio.yml b/berachain-artio.yml index 370095a9..94c77fa7 100644 --- a/berachain-artio.yml +++ b/berachain-artio.yml @@ -36,13 +36,26 @@ services: networks: - chains - berachain-artio-node-init: + berachain-artio-node-prepare: image: icculp/berachain_beacon:v0.2.0-alpha.6 - command: init someting --chain-id bartio-beacon-80084 --consensus-key-algo bls12_381 --home /root/.beacond/ + environment: + - "MONIKER=d${DOMAIN}" + command: init ${MONIKER} --chain-id bartio-beacon-80084 --consensus-key-algo bls12_381 --home /root/.beacond/ --overwrite volumes: - "berachain-artio-node:/root/.beacond/data" - "./berachain/artio/config:/root/.beacond/config" + berachain-artio-node-init: + image: alpine:latest + depends_on: + - "berachain-artio-node-prepare" + environment: + - "MONIKER=d${DOMAIN}" + volumes: + - "./berachain/artio/script/init.sh:/init.sh" + - "./berachain/artio/config:/root/.beacond/config" + entrypoint: [ "sh", "-c", "apk add --no-cache curl && sh /init.sh" ] + berachain-artio-node: image: icculp/berachain_beacon:v0.2.0-alpha.6 depends_on: @@ -52,7 +65,7 @@ services: ports: - "43471:43471" - "43471:43471/udp" - command: start --minimum-gas-prices 0atom --beacon-kit.engine.jwt-secret-path /jwtsecret --beacon-kit.kzg.trusted-setup-path /root/.beacond/config/kzg-trusted-setup.json --beacon-kit.engine.rpc-dial-url http://berachain-artio:8551 + command: start --minimum-gas-prices 0atom --beacon-kit.engine.jwt-secret-path /jwtsecret --beacon-kit.kzg.trusted-setup-path /root/.beacond/config/kzg-trusted-setup.json #command: init cometing --chain-id bartio-beacon-80084 --consensus-key-algo bls12_381 --home /root/.beacond/ networks: - chains diff --git a/berachain/artio/script/init.sh b/berachain/artio/script/init.sh new file mode 100644 index 00000000..2a10a026 --- /dev/null +++ b/berachain/artio/script/init.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Define variables +CONFIG_DIR="/root/.beacond/config" +CONFIG_TOML_URL="https://raw.githubusercontent.com/berachain/beacon-kit/main/testing/networks/80084/config.toml" +APP_TOML_URL="https://raw.githubusercontent.com/berachain/beacon-kit/main/testing/networks/80084/app.toml" +SEEDS_URL="https://raw.githubusercontent.com/berachain/beacon-kit/main/testing/networks/80084/cl-seeds.txt" + +# Create config directory if it doesn't exist +mkdir -p "$CONFIG_DIR" + +# Download the config files +curl -sL "$CONFIG_TOML_URL" -o "$CONFIG_DIR/config.toml" +curl -sL "$APP_TOML_URL" -o "$CONFIG_DIR/app.toml" + +# Update moniker +if [ -n "$MONIKER" ]; then + sed -i "s/^moniker = \".*\"/moniker = \"$MONIKER\"/" "$CONFIG_DIR/config.toml" +fi + +# Fetch and format SEEDS +SEEDS=$(curl -s "$SEEDS_URL" | tail -n +2 | tr '\n' ',' | sed 's/,$//') + +# Update seeds and persistent_peers +if [ -n "$SEEDS" ]; then + sed -i "s/^seeds = \".*\"/seeds = \"$SEEDS\"/" "$CONFIG_DIR/config.toml" + sed -i "s/^persistent_peers = \".*\"/persistent_peers = \"$SEEDS\"/" "$CONFIG_DIR/config.toml" +fi + +sed -i "s|^rpc-dial-url = \".*\"|rpc-dial-url = \"http://berachain-artio:8551\"|" "$CONFIG_DIR/app.toml"; + + +echo "Configuration updated successfully."