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