diff --git a/DOCKER/Dockerfile b/DOCKER/Dockerfile index 139fccb1131c90f5e19e79b18788f7aeffd7b936..759e64f643bea027bdadc4f1b94321045e8566a4 100644 --- a/DOCKER/Dockerfile +++ b/DOCKER/Dockerfile @@ -34,12 +34,6 @@ WORKDIR $REPO RUN go build -o /usr/local/bin/erisdb ./cmd/erisdb && \ go build -o /usr/local/bin/erisdbss ./cmd/erisdbss -# install chain manager scripts and default mint config -ENV ECM_PATH /usr/local/lib/ecm/ -RUN mkdir -p $ECM_PATH -COPY ./DOCKER/chain_* $ECM_PATH -COPY ./DOCKER/config.toml $ECM_PATH - # set the repo and install mint-client ENV REPO github.com/eris-ltd/mint-client ENV BRANCH master @@ -56,6 +50,12 @@ RUN rm -rf $GOPATH/src/* && \ unset REPO && \ unset BRANCH +# install chain manager scripts and default mint config +ENV ECM_PATH /usr/local/lib/ecm/ +RUN mkdir -p $ECM_PATH +COPY ./DOCKER/chain_* $ECM_PATH +COPY ./DOCKER/config.toml $ECM_PATH + # persist data, set user VOLUME /home/$USER/.eris WORKDIR /home/$USER/.eris diff --git a/DOCKER/build.sh b/DOCKER/build.sh index df919389c150234d0b901527c388e808bb952a3b..059d9579806ccd2c1c4050ee495e0085761ce0dc 100755 --- a/DOCKER/build.sh +++ b/DOCKER/build.sh @@ -2,7 +2,7 @@ base=github.com/eris-ltd/eris-db release="0.10" repo=$GOPATH/src/$base -branch=${ERISDB_BUILD_BRANCH:=dockerfixes} +branch=${ERISDB_BUILD_BRANCH:=develop} start=`pwd` cd $repo diff --git a/DOCKER/chain_install.sh b/DOCKER/chain_install.sh index 1969574139cde0a55a3fdc020b5e0644d0ba2e4e..e8d2279010a23d683afb9f97e7a683341e327c03 100755 --- a/DOCKER/chain_install.sh +++ b/DOCKER/chain_install.sh @@ -4,7 +4,7 @@ # get genesis, seed, copy config # get genesis if not already -if [ if -e "${CHAIN_DIR}/genesis.json" ]; then +if [ ! -e "${CHAIN_DIR}/genesis.json" ]; then # etcb chain (given by $NODE_ADDR) REFS_CHAIN_ID=$(mintinfo --node-addr $NODE_ADDR genesis chain_id) ifExit "Error fetching default chain id from $NODE_ADDR" @@ -15,7 +15,7 @@ if [ if -e "${CHAIN_DIR}/genesis.json" ]; then # get the genesis.json for a refs chain from the /genesis rpc endpoint # for a different chain, use etcb (ie namereg on the ref chain) if [ "$CHAIN_ID" = "$REFS_CHAIN_ID" ] ; then - # grab genesis.json and config + # grab genesis.json mintinfo --node-addr $NODE_ADDR genesis > "${CHAIN_DIR}/genesis.json" ifExit "Error fetching genesis.json from $NODE_ADDR" else @@ -32,11 +32,12 @@ fi # copy in config if not already if [ ! -e "${CHAIN_DIR}/config.toml" ]; then + echo "laying default config..." cp $ECM_PATH/config.toml "${CHAIN_DIR}/config.toml" ifExit "Error copying config file from $ECM_PATH to $CHAIN_DIR" if [ "$SEED_NODE" = "" ]; then - SEED_NODE=$NODE_ADDR + SEED_NODE=$NODE_HOST fi if [ "$HOST_NAME" = "" ]; then @@ -44,15 +45,16 @@ if [ ! -e "${CHAIN_DIR}/config.toml" ]; then fi fi - # set seed node and host name if [ "$SEED_NODE" != "" ]; then - sed -i "s/^\(seeds\s*=\s*\).*\$/\1\"$SEED_NODE\"/" "${CHAIN_DIR}/config.toml" + echo "Seed node: $SEED_NODE" + # NOTE the NODE_HOST must not have any slashes (no http://) + sed -i "s/^\(seeds\s*=\s*\).*\$/\1\"$NODE_HOST\"/" "${CHAIN_DIR}/config.toml" ifExit "Error setting seed node in config.toml" - echo "Seed node: ${SEED_NODE}" fi if [ "$HOST_NAME" != "" ]; then + echo "Host name: $HOST_NAME" sed -i "s/^\(moniker\s*=\s*\).*\$/\1\"$HOST_NAME\"/" "${CHAIN_DIR}/config.toml" ifExit "Error setting host name in config.toml" fi diff --git a/DOCKER/start.sh b/DOCKER/start.sh index f3dddd7adf59f458cd6c0e1bddb5e3c6b1647644..dba42aabdbf75c705bbf5943bd9d71b2c48d56e7 100755 --- a/DOCKER/start.sh +++ b/DOCKER/start.sh @@ -31,8 +31,11 @@ if [ ! -d "$CHAIN_DIR" ]; then fi # our root chain +if [ ! $NODE_HOST ]; then + NODE_HOST=interblock.io:46657 +fi if [ ! $NODE_ADDR ]; then - NODE_ADDR=http://interblock.io:46657 + NODE_ADDR=http://$NODE_HOST fi # where the etcb client scripts are @@ -44,6 +47,7 @@ fi export TMROOT export CHAIN_DIR export NODE_ADDR +export NODE_HOST export ECM_PATH # set by Dockerfile