Merge pull request #2 from confio/docker-setup
Make docker setup work for me
This commit is contained in:
commit
db110fe489
@ -10,7 +10,7 @@ Run the following:
|
||||
|
||||
## CLI
|
||||
|
||||
Docker-friendly access to `gaiacli` is provided. Just use the `./cli.sh` script.
|
||||
Docker-friendly access to `wasmcli` is provided. Just use the `./cli.sh` script.
|
||||
For example:
|
||||
|
||||
```
|
||||
|
||||
@ -2,10 +2,12 @@
|
||||
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.0"
|
||||
# Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
|
||||
REPOSITORY="cosmwasm/wasmd"
|
||||
VERSION="manual"
|
||||
|
||||
CURRENT_DIR="$(realpath "$(dirname "$0")")"
|
||||
GAIAD_CONTAINER_NAME="gaiad"
|
||||
BLOCKCHAIN_CONTAINER_NAME="wasmd"
|
||||
HOME_DIR="/home"
|
||||
|
||||
docker run \
|
||||
@ -16,6 +18,6 @@ docker run \
|
||||
-v "$CURRENT_DIR/.gaiacli:$HOME_DIR/.gaiacli" \
|
||||
-w "$HOME_DIR" \
|
||||
--env "HOME=$HOME_DIR" \
|
||||
--net "container:$GAIAD_CONTAINER_NAME" \
|
||||
"tendermint/gaia:${VERSION}" \
|
||||
gaiacli "$@"
|
||||
--net "container:$BLOCKCHAIN_CONTAINER_NAME" \
|
||||
"$REPOSITORY:$VERSION" \
|
||||
wasmcli "$@"
|
||||
|
||||
@ -1,22 +1,23 @@
|
||||
#!/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
|
||||
REPOSITORY="cosmwasm/wasmd"
|
||||
VERSION="manual"
|
||||
CONTAINER_NAME="wasmd"
|
||||
|
||||
rm -rf ./template
|
||||
mkdir ./template
|
||||
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
|
||||
|
||||
rm -rf "$SCRIPT_DIR/template"
|
||||
mkdir "$SCRIPT_DIR/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
|
||||
-e PASSWORD=my-secret-password \
|
||||
--mount type=bind,source="$SCRIPT_DIR/template",target=/root \
|
||||
"$REPOSITORY:$VERSION" \
|
||||
./setup.sh \
|
||||
cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6
|
||||
|
||||
# this is created as root, let's make it ours
|
||||
sudo chown -R "$(id -u):$(id -g)" ./template
|
||||
sudo chown -R "$(id -u):$(id -g)" "$SCRIPT_DIR/template"
|
||||
|
||||
@ -3,32 +3,41 @@ set -o errexit -o nounset -o pipefail
|
||||
command -v shellcheck > /dev/null && shellcheck "$0"
|
||||
|
||||
# Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
|
||||
REPOSITORY="cosmwasm/wasmd"
|
||||
VERSION="manual"
|
||||
CONTAINER_NAME="wasmd"
|
||||
|
||||
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"
|
||||
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
|
||||
CONTAINER_NAME="wasmd"
|
||||
|
||||
# This starts up wasmd
|
||||
docker volume rm -f wasmd_data
|
||||
docker run --rm \
|
||||
--name "$CONTAINER_NAME" \
|
||||
-p 1317:1317 \
|
||||
-p 26657:26657 \
|
||||
-p 26656:26656 \
|
||||
--mount type=bind,source="$(pwd)/template",target=/template \
|
||||
--mount type=volume,source=wasmd_data,target=/root \
|
||||
"cosmwasm/$CONTAINER_NAME:$VERSION" \
|
||||
./run_wasmd.sh /template \
|
||||
> "$WASMD_LOGFILE" &
|
||||
--name "$CONTAINER_NAME" \
|
||||
-p 1317:1317 \
|
||||
-p 26657:26657 \
|
||||
-p 26656:26656 \
|
||||
--mount type=bind,source="$SCRIPT_DIR/template",target=/template \
|
||||
--mount type=volume,source=wasmd_data,target=/root \
|
||||
"$REPOSITORY:$VERSION" \
|
||||
./run_wasmd.sh /template \
|
||||
> "$WASMD_LOGFILE" &
|
||||
|
||||
echo "wasmd running and logging into $WASMD_LOGFILE"
|
||||
|
||||
sleep 10
|
||||
|
||||
if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME")" != "true" ]; then
|
||||
echo "Container named '$CONTAINER_NAME' not running. We cannot continue." \
|
||||
"This can happen when 'docker run' needs too long to download and start." \
|
||||
"It might be worth retrying this step once the image is in the local docker cache."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker exec "$CONTAINER_NAME" \
|
||||
wasmcli rest-server \
|
||||
--node tcp://localhost:26657 \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user