2020-02-04 14:29:38 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -o errexit -o nounset -o pipefail
|
2020-12-08 09:03:14 +01:00
|
|
|
command -v shellcheck >/dev/null && shellcheck "$0"
|
2020-02-04 14:29:38 +01:00
|
|
|
|
|
|
|
## This is like start.sh but using local binaries, not docker images
|
|
|
|
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
|
|
|
|
|
|
|
|
TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/gaia.XXXXXXXXX")
|
|
|
|
chmod 777 "$TMP_DIR"
|
|
|
|
echo "Using temporary dir $TMP_DIR"
|
|
|
|
WASMD_LOGFILE="$TMP_DIR/wasmd.log"
|
|
|
|
REST_SERVER_LOGFILE="$TMP_DIR/rest-server.log"
|
|
|
|
|
|
|
|
# move the template into our temporary home
|
|
|
|
cp -r "$SCRIPT_DIR"/template/.wasm* "$TMP_DIR"
|
|
|
|
|
|
|
|
wasmd start \
|
|
|
|
--home "$TMP_DIR/.wasmd" \
|
|
|
|
--trace \
|
|
|
|
--rpc.laddr tcp://0.0.0.0:26657 \
|
2020-12-08 09:03:14 +01:00
|
|
|
>"$WASMD_LOGFILE" &
|
2020-02-04 14:29:38 +01:00
|
|
|
|
|
|
|
echo "wasmd running and logging into $WASMD_LOGFILE"
|
|
|
|
|
|
|
|
sleep 10
|
|
|
|
cat "$WASMD_LOGFILE"
|
|
|
|
|
|
|
|
wasmcli rest-server \
|
|
|
|
--home "$TMP_DIR/.wasmcli" \
|
|
|
|
--node tcp://localhost:26657 \
|
|
|
|
--trust-node \
|
|
|
|
--laddr tcp://0.0.0.0:1317 \
|
2020-12-08 09:03:14 +01:00
|
|
|
>"$REST_SERVER_LOGFILE" &
|
2020-02-04 14:29:38 +01:00
|
|
|
|
|
|
|
echo "rest server running on http://localhost:1317 and logging into $REST_SERVER_LOGFILE"
|
|
|
|
|
|
|
|
# Debug rest server start
|
|
|
|
sleep 3
|
|
|
|
cat "$REST_SERVER_LOGFILE"
|
|
|
|
|
|
|
|
tail -f "$WASMD_LOGFILE"
|