Skip to content

Commit ebb9c2c

Browse files
committed
CHange request YH: Stop trying tor ecah grafana eventually
1 parent 015cef0 commit ebb9c2c

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

services/monitoring/grafana/Makefile

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,20 @@ ensure-grafana-online:
4646
set +o allexport; \
4747
url=$${TF_VAR_GRAFANA_URL}; \
4848
echo "Waiting for grafana at $$url to become reachable..."; \
49-
while true; do \
50-
status_code=$$(curl -k -o /dev/null -s -w "%{http_code}" $$url); \
51-
if [ "$$status_code" -ge 200 ] && [ "$$status_code" -lt 400 ]; then \
52-
echo "Grafana is online"; \
53-
break; \
54-
else \
55-
echo "Grafana still unreachable, waiting 5s for grafana to become reachable..."; \
56-
sleep 5; \
57-
fi; \
58-
done;
49+
attempts=0; \
50+
max_attempts=10; \
51+
while [ $$attempts -lt $$max_attempts ]; do \
52+
status_code=$$(curl -k -o /dev/null -s -w "%{http_code}" $$url); \
53+
if [ "$$status_code" -ge 200 ] && [ "$$status_code" -lt 400 ]; then \
54+
echo "Grafana is online"; \
55+
break; \
56+
else \
57+
echo "Grafana still unreachable, waiting 5s for grafana to become reachable... (Attempt $$((attempts+1)))"; \
58+
sleep 5; \
59+
attempts=$$((attempts + 1)); \
60+
fi; \
61+
done; \
62+
if [ $$attempts -eq $$max_attempts ]; then \
63+
echo "Max attempts reached, Grafana is still unreachable."; \
64+
exit 1; \
65+
fi;

0 commit comments

Comments
 (0)