Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Commit 664fad6

Browse files
committed
fix(Makefile): improve certbot service readiness check with a loop
Replace the timeout command with a loop to check the readiness of the certbot service. The loop attempts to verify the service readiness up to 30 times, with a 2-second interval between each attempt. This change provides a more robust and clear mechanism for checking service status, ensuring that the script exits gracefully with an error message if the service fails to start within the given attempts. This approach avoids the abrupt termination that could occur with the previous timeout command.
1 parent fa16997 commit 664fad6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,17 @@ setup-ssl: ## Setup SSL certificates with Let's Encrypt (ONE-TIME MANUAL SETUP)
506506
@echo -e "$(BLUE)[INFO]$(NC) Starting certbot service to issue certificates..."
507507
$(DOCKER_COMPOSE) up -d certbot
508508
@echo -e "$(BLUE)[INFO]$(NC) Waiting for certbot service to be ready..."
509-
@timeout 60 bash -c 'until $(DOCKER_COMPOSE) exec certbot echo "Service ready" >/dev/null 2>&1; do sleep 2; done' || (echo -e "$(RED)[ERROR]$(NC) Certbot service failed to start properly" && exit 1)
509+
@for i in $$(seq 1 30); do \
510+
if $(DOCKER_COMPOSE) exec certbot echo "Service ready" >/dev/null 2>&1; then \
511+
echo -e "$(GREEN)[SUCCESS]$(NC) Certbot service is ready!"; \
512+
break; \
513+
fi; \
514+
if [ $$i -eq 30 ]; then \
515+
echo -e "$(RED)[ERROR]$(NC) Certbot service failed to start properly"; \
516+
exit 1; \
517+
fi; \
518+
sleep 2; \
519+
done
510520
@echo -e "$(BLUE)[INFO]$(NC) Issuing certificates..."
511521
$(DOCKER_COMPOSE) exec certbot /usr/local/bin/certbot-scripts/entrypoint.sh issue
512522
@echo -e "$(GREEN)[SUCCESS]$(NC) SSL certificate setup completed!"

0 commit comments

Comments
 (0)