Skip to content

Commit

Permalink
PMM-12494 Wait for PMM to be ready (#640)
Browse files Browse the repository at this point in the history
* Update docker_way_upgrade.sh

* Update docker_way_upgrade.sh

* Update docker_way_upgrade.sh
  • Loading branch information
BupycHuk authored Sep 18, 2023
1 parent facb1b6 commit b93f913
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pmm-tests/docker_way_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ if [ $# -lt 1 ]; then
exit 1
fi

wait-for-url() {
echo "Testing $1"
timeout -s TERM 240 bash -c \
'while [[ "$(curl -s -o /dev/null -L -w ''%{http_code}'' ${0})" != "200" ]];\
do echo "Waiting for ${0}" && sleep 2;\
done' ${1}
echo "OK!"
if curl -I $1; then
echo "PMM is ready"
else
echo "PMM is not ready"
fi
}

#check for Container Name To Stop before Upgrade
export PMM_SERVER_DOCKER_CONTAINER=$(docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Names}}" | grep 'pmm-server' | awk '{print $3}')
echo $PMM_SERVER_DOCKER_CONTAINER
Expand All @@ -17,5 +31,5 @@ export PMM_SERVER_DOCKER_VOLUME=$(docker ps -a --format "table {{.ID}}\t{{.Image

PWD=$(pwd) PMM_SERVER_IMAGE=$1 docker-compose up -d pmm-server
docker network connect pmm-qa pmm-server || true
sleep 30
wait-for-url http://127.0.0.1/v1/readyz
docker logs pmm-server

0 comments on commit b93f913

Please sign in to comment.