diff --git a/ci/bootstrap_gaia.sh b/ci/bootstrap_gaia.sh index 0f866951ed..58fb6cc0e5 100644 --- a/ci/bootstrap_gaia.sh +++ b/ci/bootstrap_gaia.sh @@ -3,8 +3,17 @@ # coins to add to each account coins="100000000000stake,100000000000samoleans" +home="/data/$CHAIN_ID" + echo Node: "$MONIKER" echo Chain: "$CHAIN_ID" +echo Home_Dir: "$home" + +# Clean home dir if exists +rm -Rf "$home" + +# Create home dir +mkdir -p "$home" # Check gaia version echo "-------------------------------------------------------------------------------------------------------------------" @@ -12,58 +21,53 @@ echo "Gaiad version" echo "-------------------------------------------------------------------------------------------------------------------" gaiad version --long -# Create home dir -mkdir -p "$HOME_DIR" - echo "-------------------------------------------------------------------------------------------------------------------" echo "Initialize chain $CHAIN_ID" echo "-------------------------------------------------------------------------------------------------------------------" -gaiad init "$MONIKER" --chain-id "$CHAIN_ID" --home "$HOME_DIR" +gaiad init "$MONIKER" --chain-id "$CHAIN_ID" --home "$home" echo "-------------------------------------------------------------------------------------------------------------------" echo "Adding validator key" echo "-------------------------------------------------------------------------------------------------------------------" -gaiad keys add validator --keyring-backend="test" --home $HOME_DIR --output json > "$HOME_DIR/validator_seed.json" -cat "$HOME_DIR/validator_seed.json" +gaiad keys add validator --keyring-backend="test" --home $home --output json > "$home/validator_seed.json" +cat "$home/validator_seed.json" echo "-------------------------------------------------------------------------------------------------------------------" echo "Adding use key" echo "-------------------------------------------------------------------------------------------------------------------" -gaiad keys add user --keyring-backend="test" --home $HOME_DIR --output json > "$HOME_DIR/key_seed.json" -cp "$HOME_DIR/key_seed.json" /data/key_seed_$CHAIN_ID.json -cat "$HOME_DIR/key_seed.json" +gaiad keys add user --keyring-backend="test" --home $home --output json > "$home/key_seed.json" +cat "$home/key_seed.json" echo "-------------------------------------------------------------------------------------------------------------------" echo "Adding user account to genesis" echo "-------------------------------------------------------------------------------------------------------------------" -gaiad --home $HOME_DIR add-genesis-account $(gaiad --home $HOME_DIR keys --keyring-backend="test" show user -a) $coins +# shellcheck disable=SC2046 +gaiad --home $home add-genesis-account $(gaiad --home $home keys --keyring-backend="test" show user -a) $coins echo "Done!" echo "-------------------------------------------------------------------------------------------------------------------" echo "Adding validator account to genesis" echo "-------------------------------------------------------------------------------------------------------------------" -gaiad --home $HOME_DIR add-genesis-account $(gaiad --home $HOME_DIR keys --keyring-backend="test" show validator -a) $coins +# shellcheck disable=SC2046 +gaiad --home $home add-genesis-account $(gaiad --home $home keys --keyring-backend="test" show validator -a) $coins echo "Done!" echo "-------------------------------------------------------------------------------------------------------------------" echo "Generate a genesis transaction that creates a validator with a self-delegation" echo "-------------------------------------------------------------------------------------------------------------------" -gaiad --home $HOME_DIR gentx validator --keyring-backend="test" --chain-id $CHAIN_ID +gaiad --home $home gentx validator --keyring-backend="test" --chain-id $CHAIN_ID echo "Done!" echo "-------------------------------------------------------------------------------------------------------------------" echo "Collect genesis txs and output a genesis.json file" echo "-------------------------------------------------------------------------------------------------------------------" -gaiad collect-gentxs --home $HOME_DIR +gaiad collect-gentxs --home $home echo "Done!" +TODO -> Add more sed +sed -i 's#"tcp://127.0.0.1:26657"#"tcp://'"$CHAIN_ID"':'"$RPC_PORT"'"#g' $home/config/config.toml + echo "-------------------------------------------------------------------------------------------------------------------" echo "Start the node" echo "-------------------------------------------------------------------------------------------------------------------" -gaiad start \ - --home $HOME_DIR \ - --address tcp://0.0.0.0:$RPC_PORT \ - --p2p.laddr tcp://0.0.0.0:$P2P_PORT \ - --grpc.address="0.0.0.0:$GRPC_PORT" \ - --pruning=nothing - +gaiad start --home $home --address tcp://"$CHAIN_ID":"$RPC_PORT" --p2p.laddr tcp://"$CHAIN_ID":"$P2P_PORT" --grpc.address="$CHAIN_ID":"$GRPC_PORT" --pruning=nothing \ No newline at end of file diff --git a/ci/gaia.Dockerfile b/ci/gaia.Dockerfile index 9f26ec8f36..3f6e5d6025 100644 --- a/ci/gaia.Dockerfile +++ b/ci/gaia.Dockerfile @@ -13,7 +13,7 @@ RUN git clone https://github.com/cosmos/gaia /go/src/github.com/cosmos/gaia # Set working directory for the build WORKDIR /go/src/github.com/cosmos/gaia -# Checkout branch (TODO make this a parameter) +# Checkout branch RUN git checkout $release # Install minimum necessary dependencies, build Cosmos SDK, remove packages @@ -43,5 +43,7 @@ COPY ci/bootstrap_gaia.sh . # Make it executable RUN chmod +x bootstrap_gaia.sh +EXPOSE 26657 26656 9090 + # Entrypoint ENTRYPOINT ["/bin/sh", "-c", "/gaia/bootstrap_gaia.sh"] \ No newline at end of file diff --git a/ci/setup_relayer.sh b/ci/setup_relayer.sh index 5422a32a78..09085c7508 100644 --- a/ci/setup_relayer.sh +++ b/ci/setup_relayer.sh @@ -1,14 +1,28 @@ #!/bin/sh +# Configuration file +CONFIG_PATH="$RELAYER_DIR"/"$CONFIG" +echo Config: "$CONFIG_PATH" + echo "Setting up relayer for chains:" echo Chain: "$CHAIN_A" echo Chain: "$CHAIN_B" -# Check gaia version echo "-------------------------------------------------------------------------------------------------------------------" -echo "Relayer version" +echo " Show relayer version" echo "-------------------------------------------------------------------------------------------------------------------" -rrly +rrly version -ls -allh /data +echo "-------------------------------------------------------------------------------------------------------------------" +echo " Add light client configuration for chains" +echo "-------------------------------------------------------------------------------------------------------------------" +rrly -c "$CONFIG_PATH" light add tcp://$CHAIN_A:26657 -c $CHAIN_A -s /data/$CHAIN_A -p +rrly -c "$CONFIG_PATH" light add tcp://$CHAIN_A:26657 -c $CHAIN_A -s /data/$CHAIN_A +rrly -c "$CONFIG_PATH" light add tcp://$CHAIN_B:26557 -c $CHAIN_B -s /data/$CHAIN_B -p +rrly -c "$CONFIG_PATH" light add tcp://$CHAIN_B:26557 -c $CHAIN_B -s /data/$CHAIN_B +echo "-------------------------------------------------------------------------------------------------------------------" +echo " Add keys for chains" +echo "-------------------------------------------------------------------------------------------------------------------" +rrly -c "$CONFIG_PATH" keys add "$CHAIN_A" /data/"$CHAIN_A"/key_seed.json +rrly -c "$CONFIG_PATH" keys add "$CHAIN_B" /data/"$CHAIN_B"/key_seed.json \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 0c7ebeba6f..c0fe003710 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,15 +14,14 @@ services: environment: - CHAIN_ID=ibc0 - MONIKER=node01 - - HOME_DIR=/gaia/ibc0 - RPC_PORT=26657 - P2P_PORT=26656 - GRPC_PORT=9090 volumes: - chain-data:/data networks: - relaynet: - ipv4_address: 192.168.10.2 + - relaynet +# ipv4_address: 192.168.10.2 ibc1: container_name: ibc1 build: @@ -36,15 +35,14 @@ services: environment: - CHAIN_ID=ibc1 - MONIKER=node01 - - HOME_DIR=/gaia/ibc1 - RPC_PORT=26557 - P2P_PORT=26556 - GRPC_PORT=9091 volumes: - chain-data:/data networks: - relaynet: - ipv4_address: 192.168.10.3 + - relaynet +# ipv4_address: 192.168.10.3 relayer: depends_on: - ibc0 @@ -57,8 +55,11 @@ services: - CHAIN_A=ibc0 - CHAIN_B=ibc1 - CONFIG=simple_config.toml + - RELAYER_DIR=/relayer volumes: - - chain-data:/data + - chain-data:/data + networks: + - relaynet networks: relaynet: