PromucFlow_constructor/deploy/docker/fs/opt/appsmith/auto_heal.sh
Goutham Pratapa 2f603e444c
add auto heal to cron (#29175)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced auto-healing functionality to automatically restart
unresponsive backend services.
  - Added SSL configuration support for custom domains.

- **Chores**
  - Implemented periodic backend service status checks.
- Enhanced startup scripts to support new auto-healing feature based on
environment configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-07 09:51:29 +05:30

25 lines
699 B
Bash
Executable File

#!/usr/bin/env bash
set -e
set -o xtrace
sleep 120
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)"
echo "TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"` backend response "$appsmith_status
if [[ "$appsmith_status" -ne 200 ]];
then
echo "TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"` backend is unresponsive";
supervisorctl restart backend || echo true
sleep 60
else
echo "TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"` backend is responsive";
fi
sleep 10
done