mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
fix(cli): improve API service readiness check in install script (#7468)
* fix: improve API service readiness check in install script * fix(cli): correct python indentation in api health check * fix(cli): prevent false positive api ready message on timeout
This commit is contained in:
@@ -365,17 +365,49 @@ function startServices() {
|
||||
fi
|
||||
|
||||
local api_container_id=$(docker container ls -q -f "name=$SERVICE_FOLDER-api")
|
||||
|
||||
# Verify container exists
|
||||
if [ -z "$api_container_id" ]; then
|
||||
echo " Error: API container not found. Please check if services are running."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local idx2=0
|
||||
while ! docker exec $api_container_id python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/')" > /dev/null 2>&1;
|
||||
do
|
||||
local message=">> Waiting for API Service to Start"
|
||||
local dots=$(printf '%*s' $idx2 | tr ' ' '.')
|
||||
local api_ready=true # assume success, flip on timeout
|
||||
local max_wait_time=300 # 5 minutes timeout
|
||||
local start_time=$(date +%s)
|
||||
|
||||
echo " Waiting for API Service to be ready..."
|
||||
while ! docker exec "$api_container_id" python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/', timeout=3)" > /dev/null 2>&1; do
|
||||
local current_time=$(date +%s)
|
||||
local elapsed_time=$((current_time - start_time))
|
||||
|
||||
if [ $elapsed_time -gt $max_wait_time ]; then
|
||||
echo ""
|
||||
echo " API Service health check timed out after 5 minutes"
|
||||
echo " Checking if API container is still running..."
|
||||
if docker ps | grep -q "$SERVICE_FOLDER-api"; then
|
||||
echo " API container is running but did not pass the health-check. Continuing without marking it ready."
|
||||
api_ready=false
|
||||
break
|
||||
else
|
||||
echo " API container is not running. Please check logs."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
local message=">> Waiting for API Service to Start (${elapsed_time}s)"
|
||||
local dots=$(printf '%*s' $idx2 | tr ' ' '.')
|
||||
echo -ne "\r$message$dots"
|
||||
((idx2++))
|
||||
sleep 1
|
||||
done
|
||||
printf "\r\033[K"
|
||||
echo " API Service started successfully ✅"
|
||||
if [ "$api_ready" = true ]; then
|
||||
echo " API Service started successfully ✅"
|
||||
else
|
||||
echo " ⚠️ API Service did not respond to health-check – please verify manually."
|
||||
fi
|
||||
source "${DOCKER_ENV_PATH}"
|
||||
echo " Plane Server started successfully ✅"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user