diff --git a/deploy/docker/fs/opt/appsmith/auto_heal.sh b/deploy/docker/fs/opt/appsmith/auto_heal.sh index 77777a60f9..ae3c6d18c2 100755 --- a/deploy/docker/fs/opt/appsmith/auto_heal.sh +++ b/deploy/docker/fs/opt/appsmith/auto_heal.sh @@ -6,11 +6,27 @@ set -o xtrace sleep 120 +echo "time out argument is " +echo $1 + +default_timeout="5" + +# Check if the first command-line argument is provided +if [ -z "$1" ]; then + # If not provided, assign a default value + timeout=$default_timeout +else + # If provided, use the provided value + timeout="$1" +fi + +echo "The timeout is: $timeout" + while true; do ### Get backend state echo "auto heal check" - appsmith_status="$(curl --write-out %{http_code} --silent --output /dev/null localhost:80/api/v1/tenants/current)" + appsmith_status="$(curl --max-time $timeout --write-out %{http_code} --silent --output /dev/null localhost:8080/api/v1/tenants/current || echo 1)" echo "TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"` backend response "$appsmith_status if [[ "$appsmith_status" -ne 200 ]]; then diff --git a/deploy/docker/fs/opt/appsmith/entrypoint.sh b/deploy/docker/fs/opt/appsmith/entrypoint.sh index 96697611aa..0c727b0cb4 100644 --- a/deploy/docker/fs/opt/appsmith/entrypoint.sh +++ b/deploy/docker/fs/opt/appsmith/entrypoint.sh @@ -458,7 +458,7 @@ function setup_auto_heal(){ if [[ ${APPSMITH_AUTO_HEAL-} = 1 ]]; then # By default APPSMITH_AUTO_HEAL=0 # To enable auto heal set APPSMITH_AUTO_HEAL=1 - bash /opt/appsmith/auto_heal.sh >> /appsmith-stacks/logs/cron/auto_heal.log 2>&1 & + bash /opt/appsmith/auto_heal.sh $APPSMITH_AUTO_HEAL_CURL_TIMEOUT >> /appsmith-stacks/logs/cron/auto_heal.log 2>&1 & fi }