Refactor ready-check

This commit is contained in:
cruizba 2024-03-17 04:51:22 +01:00
parent 7c40362129
commit eeb62af0c6

View File

@ -133,47 +133,46 @@ services:
- mongo
command: >
/bin/sh -c "
until $(curl --silent --head --fail http://openvidu:7880 > /dev/null); do
echo 'Waiting for OpenVidu to start...';
sleep 1;
done;
until $(curl --silent --head --fail http://ingress:9091 > /dev/null); do
echo 'Waiting for Ingress to start...';
sleep 1;
done;
until $(curl --silent --head --fail http://egress:9091 > /dev/null); do
echo 'Waiting for Ingress to start...';
sleep 1;
done;
until $(curl --silent --head --fail http://dashboard:5000 > /dev/null); do
echo 'Waiting for Dashboard to start...';
sleep 1;
done;
until $(curl --silent --head --fail http://minio:9000/minio/health/live > /dev/null); do
echo 'Waiting for Minio to start...';
sleep 1;
done;
until $(curl --silent --head --fail http://minio:9001/minio-console > /dev/null); do
echo 'Waiting for Mongo to start...';
sleep 1;
done;
until $(curl --connect-timeout 10 --silent http://mongo:27017 > /dev/null); do
echo 'Waiting for Mongo to start...';
sleep 1;
done;
URL=https://$$LOCAL_DOMAIN:4443/
if [ \"$USE_TLS\" = 'false' ]; then
URL=$(echo $$URL | sed 's/https/http/');
fi &&
sleep 10;
echo '';
echo '';
echo '------------------------';
echo 'OpenVidu is ready!';
echo \"Open $$URL in your browser\";
echo '------------------------';
echo '';
echo '';
wait_for_service() {
SERVICE_NAME=\$1
SERVICE_URL=\$2
shift 2
EXTRA=\$@
if [ -n \"\$$EXTRA\" ]; then
until curl \$$EXTRA \$$SERVICE_URL > /dev/null; do
echo \"Waiting for \$$SERVICE_NAME to start...\";
sleep 1;
done;
else
until curl --silent --head --fail \$$SERVICE_URL > /dev/null; do
echo \"Waiting for \$$SERVICE_NAME to start...\";
sleep 1;
done;
fi;
}
wait_for_service 'OpenVidu' 'http://openvidu:7880'
wait_for_service 'Ingress' 'http://ingress:9091'
wait_for_service 'Egress' 'http://egress:9091'
wait_for_service 'Dashboard' 'http://dashboard:5000'
wait_for_service 'Minio' 'http://minio:9000/minio/health/live'
wait_for_service 'Minio Console' 'http://minio:9001/minio-console'
wait_for_service 'Mongo' 'http://mongo:27017' --connect-timeout 10 --silent
URL=https://\$$LOCAL_DOMAIN:4443/
if [ \"\$$USE_TLS\" = 'false' ]; then
URL=\$(echo \$$URL | sed 's/https/http/')
fi
sleep 10
echo ''
echo ''
echo '------------------------'
echo 'OpenVidu is ready!'
echo \"Open \$$URL in your browser\"
echo '------------------------'
echo ''
echo ''
"
setup-volumes: