diff --git a/docker/run_relayer.sh b/docker/run_relayer.sh index 91ab8e0d6..91048f385 100755 --- a/docker/run_relayer.sh +++ b/docker/run_relayer.sh @@ -16,13 +16,13 @@ rm -f $dir_prefix/NETWORK_READY until cat $dir_prefix/NETWORK_READY &> /dev/null do - if [[ retry_count -ge 600 ]]; then + if [[ retry_count -ge 300 ]]; then echo "Subnets didn't start up quickly enough." exit 1 fi echo "Waiting for subnets to start up. Retry count: $retry_count" retry_count=$((retry_count+1)) - sleep 1 + sleep 2 done # Source all variables set in run_setup.sh diff --git a/scripts/deploy_teleporter.sh b/scripts/deploy_teleporter.sh index 282ff3398..6b3d4c908 100755 --- a/scripts/deploy_teleporter.sh +++ b/scripts/deploy_teleporter.sh @@ -58,7 +58,7 @@ while [ $# -gt 0 ]; do --help) printHelp && exit 0 ;; *) - echo "Invalid option: -$1" && printHelp && exit 1;; + echo "Invalid option: $1" && printHelp && exit 1;; esac shift done diff --git a/scripts/lint.sh b/scripts/lint.sh index d93066a0c..746f1e857 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -82,7 +82,7 @@ while [ $# -gt 0 ]; do -h | --help) printHelp ;; *) - echo "Invalid option: -$1" && printHelp && exit 1;; + echo "Invalid option: $1" && printHelp && exit 1;; esac shift done diff --git a/scripts/local/run.sh b/scripts/local/run.sh index d0ba1d77d..71aa9ca6b 100755 --- a/scripts/local/run.sh +++ b/scripts/local/run.sh @@ -7,19 +7,7 @@ set -e # Stop on first error source ./scripts/utils.sh source ./scripts/versions.sh -LOCAL_RELAYER_IMAGE= -RUN_STOP_FLAG="-c" -HELP= -while [ $# -gt 0 ]; do - case "$1" in - -l | --local-relayer-image) LOCAL_RELAYER_IMAGE=$2 ;; - -p | --pause) RUN_STOP_FLAG= ;; - -h | --help) HELP=true ;; - esac - shift -done - -if [ "$HELP" = true ]; then +function printHelp { echo "Usage: ./scripts/local/run.sh [OPTIONS]" echo "Run Teleporter." echo "" @@ -27,8 +15,7 @@ if [ "$HELP" = true ]; then echo " -l, --local-relayer-image Use a local AWM Relayer image instead of pulling from dockerhub" echo " -p, --pause Pause the network on stop. Will attempt to restart the paused network on subsequent runs" echo " -h, --help Print this help message" - exit 0 -fi +} function cleanup { echo "Shutting down network before exiting..." @@ -36,11 +23,22 @@ function cleanup { echo "Network stopped" } +LOCAL_RELAYER_IMAGE= +RUN_STOP_FLAG="-c" +while [ $# -gt 0 ]; do + case "$1" in + -l | --local-relayer-image) LOCAL_RELAYER_IMAGE=$2 ;; + -p | --pause) RUN_STOP_FLAG= ;; + -h | --help) printHelp && exit 0 ;; + *) echo "Invalid option: $1" && printHelp && exit 1;; + esac + shift +done + # Set up the trap to catch the SIGINT signal (CTRL+C) # Note that the output of the cleanup function defined in run_setup.sh does not appear if CTRL+C is used to kill this script, # but the function does in fact run as expected. -trap cleanup SIGTERM -trap cleanup SIGINT +trap cleanup SIGTERM SIGINT # Set ARCH env so as a container executes without issues in a portable way # Should be amd64 for linux/macos x86 hosts, and arm64 for macos M1 @@ -50,6 +48,7 @@ setARCH if [ -z "$LOCAL_RELAYER_IMAGE" ]; then echo "Using published awm-relayer image" docker compose -f docker/docker-compose-run.yml --project-directory ./ up --abort-on-container-exit --build & + docker_pid=$! else echo "Using local awm-relayer image: $LOCAL_RELAYER_IMAGE" if [[ "$(docker images -q awm-relayer:$LOCAL_RELAYER_IMAGE 2> /dev/null)" == "" ]]; then @@ -59,6 +58,7 @@ else rm -f docker/docker-compose-run-local.yml sed "s//$LOCAL_RELAYER_IMAGE/g" docker/docker-compose-run-local-template.yml > docker/docker-compose-run-local.yml docker compose -f docker/docker-compose-run-local.yml --project-directory ./ up --abort-on-container-exit --build & + docker_pid=$! fi -tail -f /dev/null +wait $docker_pid