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

fetch > install, cleanup

parent 8792c0e1
No related branches found
No related tags found
Loading
#! /bin/sh #! /bin/sh
ifExit(){ #-----------------------------------------------------------------------
if [ $? -ne 0 ]; then # get genesis, seed, copy config
echo $1
exit 1
fi
}
# fetching a chain means grabbing its genesis.json (from etcb) and putting it in the right folder # etcb chain (given by $NODE_ADDR)
# we also copy in the config.toml, and update grab the seed node from etcb
## get chain id for main reference chain (given by NODE_ADDR)
REFS_CHAIN_ID=$(mintinfo --node-addr $NODE_ADDR genesis chain_id) 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
...@@ -49,6 +42,7 @@ echo "Host name: ${HOST_NAME}" ...@@ -49,6 +42,7 @@ echo "Host name: ${HOST_NAME}"
sed -i "s/^\(moniker\s*=\s*\).*\$/\1\"$HOST_NAME\"/" "${CHAIN_DIR}/config.toml" sed -i "s/^\(moniker\s*=\s*\).*\$/\1\"$HOST_NAME\"/" "${CHAIN_DIR}/config.toml"
ifExit "Error setting host name in config.toml" ifExit "Error setting host name in config.toml"
#-----------------------------------------------------------------------
# would be nice if we could stop syncing once we're caught up ... # would be nice if we could stop syncing once we're caught up ...
echo "Running mint in ${CHAIN_DIR}" echo "Running mint in ${CHAIN_DIR}"
......
#! /bin/bash #! /bin/sh
ifExit(){
if [ $? -ne 0 ]; then
echo $1
exit 1
fi
}
# if no CHAIN_ID, get that off the main test net # if no CHAIN_ID, get that off the main test net
if [[ ! $CHAIN_ID ]]; then if [[ ! $CHAIN_ID ]]; then
......
# This is a TOML config file. # This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml # For more information, see https://github.com/toml-lang/toml
moniker = "eris_db" moniker = "eris_chains"
node_laddr = "0.0.0.0:46656" node_laddr = "0.0.0.0:46656"
seeds = "interblock.io:46656" seeds = ""
fast_sync = true fast_sync = false
db_backend = "leveldb" db_backend = "leveldb"
log_level = "debug" log_level = "debug"
rpc_laddr = "0.0.0.0:46657" rpc_laddr = "0.0.0.0:46657"
...@@ -7,6 +7,9 @@ ifExit(){ ...@@ -7,6 +7,9 @@ ifExit(){
fi fi
} }
#------------------------------------------------
# set and export directories
############################################# #############################################
# We expect the following env vars to be set # We expect the following env vars to be set
# $CHAIN_ID # $CHAIN_ID
...@@ -19,6 +22,7 @@ ifExit(){ ...@@ -19,6 +22,7 @@ ifExit(){
# and eg. $CONTAINER_NAME # and eg. $CONTAINER_NAME
CHAIN_DIR="/home/$USER/.eris/blockchains/$CHAIN_ID" CHAIN_DIR="/home/$USER/.eris/blockchains/$CHAIN_ID"
# set the tendermint directory
TMROOT=$CHAIN_DIR TMROOT=$CHAIN_DIR
if [ ! -d "$CHAIN_DIR" ]; then if [ ! -d "$CHAIN_DIR" ]; then
...@@ -43,26 +47,17 @@ export NODE_ADDR ...@@ -43,26 +47,17 @@ export NODE_ADDR
export ECM_PATH # set by Dockerfile export ECM_PATH # set by Dockerfile
#-----------------------------------------------------------------------
# either we are fetching a chain for the first time, # either we are fetching a chain for the first time,
# creating one from scratch, or running one we already have # creating one from scratch, or running one we already have
CMD=$1 CMD=$1
case $CMD in case $CMD in
"fetch" ) $ECM_PATH/chain_fetch.sh "install" ) $ECM_PATH/chain_install.sh
;; ;;
"new" ) $ECM_PATH/chain_new.sh "new" ) $ECM_PATH/chain_new.sh
;; ;;
"run" ) $ECM_PATH/chain_run.sh "run" ) $ECM_PATH/chain_run.sh
;; ;;
*) echo "Enter a command for starting the chain (fetch, new, run)" *) echo "Enter a command for starting the chain (install, new, run)"
;; ;;
esac esac
#--------------------------------------------------------------------------------
# XXX: assume for now the chain_id is always given
#
## if no CHAIN_ID given, use the ref chain
#if [ ! $CHAIN_ID ]; then
# CHAIN_ID=$REFS_CHAIN_ID
#fi
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