Update cosm scripts for wasmd

This commit is contained in:
Ethan Frey 2020-01-22 15:37:53 +01:00
parent 4d061b4c37
commit 86383602a7
2 changed files with 40 additions and 27 deletions

View File

@ -0,0 +1,22 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
command -v shellcheck > /dev/null && shellcheck "$0"
# Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
VERSION="manual"
CONTAINER_NAME="wasmd"
rm -rf ./template
mkdir ./template
# any any more addresses you want to fund in genesis below
docker run --rm \
-e PASSWORD=my-secret-password \
--mount type=bind,source="$(pwd)/template",target=/root \
"$CONTAINER_NAME:$VERSION" \
./setup.sh \
cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6
# this is created as root, let's make it ours
sudo chown -R "$(id -u):$(id -g)" ./template

View File

@ -2,45 +2,36 @@
set -o errexit -o nounset -o pipefail set -o errexit -o nounset -o pipefail
command -v shellcheck > /dev/null && shellcheck "$0" command -v shellcheck > /dev/null && shellcheck "$0"
# Choose from https://hub.docker.com/r/tendermint/gaia/tags # Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
VERSION="v2.0.4" VERSION="manual"
CONTAINER_NAME="wasmd"
TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/gaia.XXXXXXXXX") TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/gaia.XXXXXXXXX")
chmod 777 "$TMP_DIR" chmod 777 "$TMP_DIR"
echo "Using temporary dir $TMP_DIR" echo "Using temporary dir $TMP_DIR"
GAIAD_LOGFILE="$TMP_DIR/gaiad.log" WASMD_LOGFILE="$TMP_DIR/wasmd.log"
REST_SERVER_LOGFILE="$TMP_DIR/rest-server.log" REST_SERVER_LOGFILE="$TMP_DIR/rest-server.log"
CURRENT_DIR="$(realpath "$(dirname "$0")")"
HOME_DIR="/home"
CONTAINER_NAME="gaiad"
rm -rf "$CURRENT_DIR/.gaiad/data" HOME_DIR="/root"
mkdir -p "$CURRENT_DIR/.gaiad/data"
cp "$CURRENT_DIR/priv_validator_state.template.json" "$CURRENT_DIR/.gaiad/data/priv_validator_state.json"
docker run \ # This starts up wasmd
--rm \ docker volume rm -f wasmd_data
--user="$UID" \ docker run --rm \
-t \ --name "$CONTAINER_NAME" \
--name "$CONTAINER_NAME" \ -p 26657:26657 \
-v "$CURRENT_DIR/.gaiad:$HOME_DIR/.gaiad" \ -p 26656:26656 \
-v "$CURRENT_DIR/.gaiacli:$HOME_DIR/.gaiacli" \ --mount type=bind,source=$(pwd)/template,target=/template \
-w "$HOME_DIR" \ --mount type=volume,source=wasmd_data,target=/root \
--env "HOME=$HOME_DIR" \ "$CONTAINER_NAME:$VERSION" \
-p 46656:46656 \ ./run_wasmd.sh /template \
-p 46657:46657 \ > "$WASMD_LOGFILE" &
-p 1317:1317 \
"tendermint/gaia:${VERSION}" \
gaiad start \
--rpc.laddr tcp://0.0.0.0:46657 \
> "$GAIAD_LOGFILE" &
echo "gaiad running and logging into $GAIAD_LOGFILE" echo "wasmd running and logging into $WASMD_LOGFILE"
sleep 10 sleep 10
docker exec "$CONTAINER_NAME" \ docker exec "$CONTAINER_NAME" \
gaiacli rest-server \ wasmcli rest-server \
--node tcp://localhost:46657 \ --node tcp://localhost:46657 \
--trust-node \ --trust-node \
--laddr tcp://0.0.0.0:1317 \ --laddr tcp://0.0.0.0:1317 \