Skip to content

Commit

Permalink
Gracefull halting & removed pruning see cosmos/cosmos-sdk#6370 for de…
Browse files Browse the repository at this point in the history
…tails
  • Loading branch information
asmodat committed Apr 7, 2021
1 parent 9f7dea9 commit f1b0b3e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docker/kira/container/sentry/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ $SELF_CONTAINER/configure.sh
set +e && source "/etc/profile" &>/dev/null && set -e

touch $EXECUTED_CHECK
sekaid start --home=$SEKAID_HOME --grpc.address="$GRPC_ADDRESS" --trace --pruning=everything
sekaid start --home=$SEKAID_HOME --grpc.address="$GRPC_ADDRESS" --trace
4 changes: 2 additions & 2 deletions docker/kira/container/snapshot/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ while :; do
sleep 10
kill -2 "$PID1" || echo "INFO: Failed to kill sekai PID $PID1"
rm -fv $CFG # invalidate all possible connections
sekaid start --home="$SEKAID_HOME" --grpc.address="$GRPC_ADDRESS" --trace --pruning=everything &>./output2.log &# launch sekai in state observer mode
sekaid start --home="$SEKAID_HOME" --grpc.address="$GRPC_ADDRESS" --trace &>./output2.log &# launch sekai in state observer mode
PID1=$!
sleep 10
FINISHED_RUNNING="true"
Expand Down Expand Up @@ -165,7 +165,7 @@ while :; do
echo "INFO: Cloning genesis and strarting block sync..."
cp -f -v -a "$COMMON_CFG" "$CFG" # recover config from common folder
cp -a -v -f "$COMMON_GENESIS" "$LOCAL_GENESIS" # recover genesis from common folder
sekaid start --home="$SEKAID_HOME" --grpc.address="$GRPC_ADDRESS" --halt-height="$HALT_HEIGHT" --trace --pruning=everything &>./output.log || echo "halted" &
sekaid start --home="$SEKAID_HOME" --grpc.address="$GRPC_ADDRESS" --halt-height="$HALT_HEIGHT" --trace &>./output.log || echo "halted" &
PID1="$!"
sleep 10
i=0
Expand Down
2 changes: 1 addition & 1 deletion docker/kira/container/validator/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ $SELF_CONTAINER/configure.sh
set +e && source "/etc/profile" &>/dev/null && set -e

echoInfo "INFO: Starting validator..."
sekaid start --home=$SEKAID_HOME --trace --pruning=everything
sekaid start --home=$SEKAID_HOME --trace
9 changes: 8 additions & 1 deletion workstation/kira/kira-networking.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,22 @@ echo -e "\e[37;1m--------------------------------------------------"
echoInfo "INFO: Starting $TYPE editor..."
$KIRA_MANAGER/kira/seeds-edit.sh "$FILE" "$EXPOSURE $TARGET"

COMMON_PATH="$DOCKER_COMMON/$DOCKER_COMMON"
EXIT_FILE="$COMMON_PATH/exit"
HALT_FILE="$COMMON_PATH/halt"

echoInfo "INFO: Copying $TYPE configuration to the $CONTAINER container common directory..."
cp -a -v -f "$FILE" "$DOCKER_COMMON/$CONTAINER/$TYPE"
cp -a -v -f "$FILE" "$COMMON_PATH/$TYPE"

echoInfo "INFO: To apply changes you will have to restart your $EXPOSURE facing $CONTAINER container"
SELECT="." && while ! [[ "${SELECT,,}" =~ ^(r|c)$ ]] ; do echoNErr "Choose to [R]estart $CONTAINER container or [C]ontinue: " && read -d'' -s -n1 SELECT && echo ""; done
[ "${SELECT,,}" == "c" ] && continue

echoInfo "INFO: Re-starting $CONTAINER container..."
touch "$EXIT_FILE"
cntr=0 && while [ -f "$EXIT_FILE" ] && [ $cntr -lt 20 ] ; do echoInfo "INFO: Waiting for container '$CONTAINER' to halt ($cntr/20) ..." && cntr=$(($cntr + 1)) && sleep 5 ; done
$KIRA_SCRIPTS/container-restart.sh $CONTAINER
rm -fv "$HALT_FILE" "$EXIT_FILE"
elif [ "${OPTION,,}" == "f" ]; then
echoInfo "INFO: Reinitalizing firewall..."
$KIRA_MANAGER/networking.sh
Expand Down
4 changes: 4 additions & 0 deletions workstation/scripts/await-seed-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SEED_NODE_ID=$2
COMMON_PATH="$DOCKER_COMMON/$CONTAINER_NAME"
COMMON_LOGS="$COMMON_PATH/logs"
HALT_FILE="$COMMON_PATH/halt"
EXIT_FILE="$COMMON_PATH/exit"

while : ; do
PREVIOUS_HEIGHT=0
Expand Down Expand Up @@ -108,7 +109,10 @@ while : ; do
set -x
if [ "${ACCEPT,,}" == "r" ] ; then
echoWarn "WARINIG: Container sync operation will be attempted again, please wait..." && sleep 5
touch "$EXIT_FILE"
cntr=0 && while [ -f "$EXIT_FILE" ] && [ $cntr -lt 20 ] ; do echoInfo "INFO: Waiting for container '$CONTAINER_NAME' to halt ($cntr/20) ..." && cntr=$(($cntr + 1)) && sleep 5 ; done
$KIRA_SCRIPTS/container-restart.sh "$CONTAINER_NAME"
rm -fv "$HALT_FILE" "$EXIT_FILE"
sleep 5
continue
else
Expand Down
12 changes: 10 additions & 2 deletions workstation/scripts/await-sentry-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ SAVE_SNAPSHOT=$3
[ -z "$SAVE_SNAPSHOT" ] && SAVE_SNAPSHOT="false"
COMMON_PATH="$DOCKER_COMMON/$CONTAINER_NAME"
COMMON_LOGS="$COMMON_PATH/logs"
HALT_FILE="$COMMON_PATH/halt"
EXIT_FILE="$COMMON_PATH/exit"

while : ; do
PREVIOUS_HEIGHT=0
Expand Down Expand Up @@ -109,7 +111,10 @@ while : ; do
set -x
if [ "${ACCEPT,,}" == "r" ] ; then
echoWarn "WARINIG: Container sync operation will be attempted again, please wait..." && sleep 5
touch "$EXIT_FILE"
cntr=0 && while [ -f "$EXIT_FILE" ] && [ $cntr -lt 20 ] ; do echoInfo "INFO: Waiting for container '$CONTAINER_NAME' to halt ($cntr/20) ..." && cntr=$(($cntr + 1)) && sleep 5 ; done
$KIRA_SCRIPTS/container-restart.sh "$CONTAINER_NAME"
rm -fv "$HALT_FILE" "$EXIT_FILE"
sleep 5
continue
else
Expand Down Expand Up @@ -177,6 +182,7 @@ if [ "${SAVE_SNAPSHOT,,}" == "true" ] ; then
cntr=0 && while [ -f "$EXIT_FILE" ] && [ $cntr -lt 10 ] ; do echoInfo "INFO: Waiting for container '$CONTAINER_NAME' to halt ($cntr/10) ..." && cntr=$(($cntr + 1)) && sleep 15 ; done
echoInfo "INFO: Re-starting $CONTAINER_NAME container..."
$KIRA_SCRIPTS/container-restart.sh $CONTAINER_NAME
rm -fv "$HALT_FILE" "$EXIT_FILE"

echoInfo "INFO: Creating new snapshot..."

Expand All @@ -196,9 +202,11 @@ if [ "${SAVE_SNAPSHOT,,}" == "true" ] ; then
CDHelper text lineswap --insert="KIRA_SNAP_PATH=\"$DESTINATION_FILE\"" --prefix="KIRA_SNAP_PATH=" --path=$ETC_PROFILE --append-if-found-not=True

echo "INFO: Un-Halting $CONTAINER_NAME container"
rm -fv $HALT_FILE
echo "INFO: Re-starting $CONTAINER_NAME container..."
touch $EXIT_FILE
cntr=0 && while [ -f "$EXIT_FILE" ] && [ $cntr -lt 10 ] ; do echoInfo "INFO: Waiting for container '$CONTAINER_NAME' to halt ($cntr/10) ..." && cntr=$(($cntr + 1)) && sleep 15 ; done
echoInfo "INFO: Re-starting $CONTAINER_NAME container..."
$KIRA_SCRIPTS/container-restart.sh $CONTAINER_NAME
rm -fv "$HALT_FILE" "$EXIT_FILE"

ls -1 "$KIRA_SNAP"
[ ! -f "$DESTINATION_FILE" ] && echoErr "ERROR: Failed to create snpashoot, file $DESTINATION_FILE was not found." && exit 1
Expand Down

0 comments on commit f1b0b3e

Please sign in to comment.