Skip to content
Snippets Groups Projects
Commit ebe9c40e authored by Ethan Buchman's avatar Ethan Buchman
Browse files

ecm cleanup, back to bash

parent be6622f8
No related branches found
No related tags found
No related merge requests found
...@@ -34,9 +34,11 @@ WORKDIR $REPO ...@@ -34,9 +34,11 @@ WORKDIR $REPO
RUN go build -o /usr/local/bin/erisdb ./cmd/erisdb && \ RUN go build -o /usr/local/bin/erisdb ./cmd/erisdb && \
go build -o /usr/local/bin/erisdbss ./cmd/erisdbss go build -o /usr/local/bin/erisdbss ./cmd/erisdbss
# install chain manager scripts # install chain manager scripts and default mint config
COPY ./DOCKER/chain_* /usr/local/bin/ ENV ECM_PATH /usr/local/lib/ecm/
ENV ECM_PATH /usr/local/bin RUN mkdir -p $ECM_PATH
COPY ./DOCKER/chain_* $ECM_PATH
COPY ./DOCKER/config.toml $ECM_PATH
# set the repo and install mint-client # set the repo and install mint-client
ENV REPO github.com/eris-ltd/mint-client ENV REPO github.com/eris-ltd/mint-client
...@@ -62,4 +64,5 @@ RUN mkdir --parents /home/$USER/.eris/blockchains/tendermint ...@@ -62,4 +64,5 @@ RUN mkdir --parents /home/$USER/.eris/blockchains/tendermint
ENV TMROOT /home/$USER/.eris/blockchains/tendermint ENV TMROOT /home/$USER/.eris/blockchains/tendermint
# run tendermint # run tendermint
ENTRYPOINT ["erisdb-wrapper"] # really should be entrypoint but broken in API 1.19
CMD ["erisdb-wrapper"]
#! /bin/sh #! /bin/bash
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# get genesis, seed, copy config # get genesis, seed, copy config
...@@ -8,9 +8,11 @@ REFS_CHAIN_ID=$(mintinfo --node-addr $NODE_ADDR genesis chain_id) ...@@ -8,9 +8,11 @@ REFS_CHAIN_ID=$(mintinfo --node-addr $NODE_ADDR genesis chain_id)
ifExit "Error fetching default chain id from $NODE_ADDR" ifExit "Error fetching default chain id from $NODE_ADDR"
REFS_CHAIN_ID=$(echo "$REFS_CHAIN_ID" | tr -d '"') # remove surrounding quotes REFS_CHAIN_ID=$(echo "$REFS_CHAIN_ID" | tr -d '"') # remove surrounding quotes
echo "etcb chain: $REFS_CHAIN_ID"
# get the genesis.json for a refs chain from the /genesis rpc endpoint # 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) # for a different chain, use etcb (ie namereg on the ref chain)
if [ "$CHAIN_ID" = "$REF_CHAIN_ID" ] ; then if [ "$CHAIN_ID" = "$REFS_CHAIN_ID" ] ; then
# grab genesis.json and config # grab genesis.json and config
mintinfo --node-addr $NODE_ADDR genesis > "${CHAIN_DIR}/genesis.json" mintinfo --node-addr $NODE_ADDR genesis > "${CHAIN_DIR}/genesis.json"
ifExit "Error fetching genesis.json from $NODE_ADDR" ifExit "Error fetching genesis.json from $NODE_ADDR"
......
#! /bin/sh #! /bin/bash
echo "new chain: $CHAIN_ID" echo "new chain: $CHAIN_ID"
if [ "$GENERATE_GENESIS" = "true" ]; then if [ "$GENERATE_GENESIS" = "true" ]; then
mintgen --single $CHAIN_DIR mintgen --single $CHAIN_DIR
ifExit "Error creating genesis file"
fi fi
if [ "$RUN" = "true" ]; then if [ "$RUN" = "true" ]; then
tendermint node tendermint node
ifExit "Error starting tendermint"
else else
# this will just run for a second and quit # this will just run for a second and quit
tendermint node & last_pid=$! && sleep 1 && kill -KILL $last_pid tendermint node & last_pid=$! && sleep 1 && kill -KILL $last_pid
ifExit "Error starting tendermint"
fi fi
#! /bin/sh #! /bin/bash
# if no CHAIN_ID, get that off the main test net
if [[ ! $CHAIN_ID ]]; then
# get the chain id
CHAIN_ID=$(mintinfo --node-addr $NODE_ADDR genesis chain_id)
ifExit "Error fetching default chain id from $NODE_ADDR"
CHAIN_ID=$(echo "$CHAIN_ID" | tr -d '"') # remove surrounding quotes
fi
CHAIN_DIR="${ROOT_DIR}/$CHAIN_ID"
if [[ ! -d $CHAIN_DIR ]]; then
echo "Unknown chain ($CHAIN_ID)"
exit 1
fi
echo Running chain $CHAIN_ID echo Running chain $CHAIN_ID
tendermint node tendermint node
#! /bin/sh #! /bin/bash
ifExit(){ ifExit(){
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
...@@ -7,15 +7,15 @@ ifExit(){ ...@@ -7,15 +7,15 @@ ifExit(){
fi fi
} }
export -f ifExit
#------------------------------------------------ #------------------------------------------------
# set and export directories # set and export directories
############################################# if [ "$CHAIN_ID" = "" ]; then
# We expect the following env vars to be set echo "ecm requires CHAIN_ID be set"
# $CHAIN_ID exit 1
# fi
# one day we'll make it more flexible
# for now the only consumer is eris-cli
# TODO: deal with chain numbers # TODO: deal with chain numbers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment