Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make docker setup work for me #2

Merged
merged 6 commits into from
Jan 23, 2020
Merged

Make docker setup work for me #2

merged 6 commits into from
Jan 23, 2020

Conversation

webmaster128
Copy link
Member

The helper script cli.sh was updated but does not work due to CosmWasm/wasmd#43 (which is not a blocker as far as I can see)

Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works locally and now independent of $(pwd). Thank you.

Making an issue for the comments I left

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I would like to use this everywhere. And yes, I forgot to update here.

One issue that I had is that other code uses --name=$CONTAINER_NAME, but docker doesn't like / in name, so I need to split it somehow. That's a different issue, but curious about it. Also it would be nice to pull out these common config into one env file that the other scripts source

Copy link
Member Author

@webmaster128 webmaster128 Jan 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is now called REPOSITORY was hardcoded in the IOV Core scripts. Good to have it visible in the top of the file.

I don't think this should be mixed up with CONTAINER_NAME, which is a local name that might or might not be the last part of REPOSITORY.

scripts/cosm/generate_template.sh Show resolved Hide resolved

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I wonder if we can make this automatically from above config?
CONTAINER_NAME=$(echo $REPOSITORY | cut -d/ -f2)
seems to work.

Both of the following return wasmd:

echo wasmd | cut -d/ -f2
echo cosmwasm/wasmd | cut -d/ -f2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, possible. I this case I have a slight tendency to avoid indirection.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remove the --user flag, it runs, but I wonder a bit about the design. I can even make HOME=/root.

The main issue (besides user account) is mounts. It mounts local .gaiad and .gaiacli. It needs to mount .wasmcli (and not .wasmd at all.. this is just to run the cli command). Further, I wonder about having the local .gaiacli stored in the filesystem somewhere, whereever you execute the cli. A more modern way to mount a "global" docker volume is like in start:

--mount type=volume,source=wasmcli_data,target=/root/.wasmcli \

I will make some changes in a new PR. This one is a good improvement with paths already

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --user flag is became best practice because of Linux machines where the docker deamon runs as root. Then all the output files are owned by your local user instead of root in the host.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that. In my PR I use a custom volume to store data, so it is never written to the local filesystem (and causing the issues with root files everywhere)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants