scripts: Add simapp scripts
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -o errexit -o nounset -o pipefail
|
||||
command -v shellcheck > /dev/null && shellcheck "$0"
|
||||
|
||||
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
|
||||
# shellcheck source=./env
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/env
|
||||
|
||||
rm -rf "$SCRIPT_DIR/template"
|
||||
mkdir "$SCRIPT_DIR/template"
|
||||
cp setup.sh "$SCRIPT_DIR/template/"
|
||||
cp run_simd.sh "$SCRIPT_DIR/template/"
|
||||
|
||||
# The usage of the accounts below is documented in README.md of this directory
|
||||
docker run --rm \
|
||||
-e PASSWORD=my-secret-password \
|
||||
--mount type=bind,source="$SCRIPT_DIR/template",target=/root \
|
||||
"$REPOSITORY:$VERSION" \
|
||||
./setup.sh \
|
||||
cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5 cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx \
|
||||
cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada cosmos1hhg2rlu9jscacku2wwckws7932qqqu8x3gfgw0 cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5 cosmos17yg9mssjenmc3jkqth6ulcwj9cxujrxxzezwta cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce \
|
||||
cosmos1lvrwcvrqlc5ktzp2c4t22xgkx29q3y83lktgzl cosmos1vkv9sfwaak76weyamqx0flmng2vuquxqcuqukh cosmos106jwym4s9aujcmes26myzzwqsccw09sdm0v5au cosmos1c7wpeen2uv8thayf7g8q2rgpm29clj0dgrdtzw cosmos1mjxpv9ft30wer7ma7kwfxhm42l379xutplrdk6 \
|
||||
cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u \
|
||||
cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej
|
||||
|
||||
# The ./template folder is created by the docker daemon's user (root on Linux, current user
|
||||
# when using Docker Desktop on macOS), let's make it ours if needed
|
||||
if [ ! -x "$SCRIPT_DIR/template/.simapp/config/gentx" ]; then
|
||||
sudo chown -R "$(id -u):$(id -g)" "$SCRIPT_DIR/template"
|
||||
fi
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -o errexit -o nounset -o pipefail
|
||||
command -v shellcheck > /dev/null && shellcheck "$0"
|
||||
|
||||
mkdir -p /root/log
|
||||
|
||||
simd start --rpc.laddr tcp://0.0.0.0:26657 --trace
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -o errexit -o nounset -o pipefail
|
||||
command -v shellcheck > /dev/null && shellcheck "$0"
|
||||
|
||||
PASSWORD=${PASSWORD:-1234567890}
|
||||
STAKE=${STAKE_TOKEN:-ustake}
|
||||
FEE=${FEE_TOKEN:-ucosm}
|
||||
CHAIN_ID=${CHAIN_ID:-testing}
|
||||
|
||||
simd init --chain-id="$CHAIN_ID" "$CHAIN_ID"
|
||||
# staking/governance token is hardcoded in config, change this
|
||||
sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json
|
||||
if ! simcli keys show validator; then
|
||||
(echo "$PASSWORD"; echo "$PASSWORD") | simcli keys add validator
|
||||
fi
|
||||
# hardcode the validator account for this instance
|
||||
echo "$PASSWORD" | simd add-genesis-account validator "1000000000$STAKE,1000000000$FEE"
|
||||
# (optionally) add a few more genesis accounts
|
||||
for addr in "$@"; do
|
||||
echo $addr
|
||||
simd add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE"
|
||||
done
|
||||
# submit a genesis validator tx
|
||||
(echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | simd gentx --name validator --amount "250000000$STAKE"
|
||||
simd collect-gentxs
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -o errexit -o nounset -o pipefail
|
||||
command -v shellcheck > /dev/null && shellcheck "$0"
|
||||
|
||||
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
|
||||
# shellcheck source=./env
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/env
|
||||
|
||||
echo "$CONTAINER_NAME"
|
||||
|
||||
TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/simapp.XXXXXXXXX")
|
||||
chmod 777 "$TMP_DIR"
|
||||
echo "Using temporary dir $TMP_DIR"
|
||||
SIMD_LOGFILE="$TMP_DIR/simd.log"
|
||||
PORT=26657
|
||||
|
||||
docker run --rm \
|
||||
--name "$CONTAINER_NAME" \
|
||||
-p "$PORT:$PORT" \
|
||||
--mount type=bind,source="$SCRIPT_DIR/template",target=/root \
|
||||
"$REPOSITORY:$VERSION" \
|
||||
./run_simd.sh \
|
||||
> "$SIMD_LOGFILE" &
|
||||
|
||||
echo "simd running on http://localhost:$PORT and logging into $SIMD_LOGFILE"
|
||||
|
||||
if [ -n "${CI:-}" ]; then
|
||||
# Follow the logs in CI's background job
|
||||
tail -f "$SIMD_LOGFILE"
|
||||
fi
|
||||
Reference in New Issue
Block a user