Skip to content

Commit df5f1d1

Browse files
committed
feat(Makefile): status reports and better error handling
Adds a Status: message to report the status of the service being monitored every 10 seconds (code from StDiluted in IRC). Also checks for dead services, and actually exits when encountering an erred service - we previously just kept humming along.
1 parent e5500d4 commit df5f1d1

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ define ssh_all
2020
endef
2121

2222
define check_for_errors
23-
@if fleetctl --strict-host-key-checking=false list-units|grep -q "failed"; then \
23+
@if fleetctl --strict-host-key-checking=false list-units | egrep -q "(failed|dead)"; then \
2424
echo "\033[0;31mOne or more services failed! Check which services by running 'make status'\033[0m" ; \
2525
echo "\033[0;31mYou can get detailed output with 'fleetctl status deis-servicename.service'\033[0m" ; \
2626
echo "\033[0;31mThis usually indicates an error with Deis - please open an issue on GitHub or ask for help in IRC\033[0m" ; \
27+
exit 1 ; \
2728
fi
2829
endef
2930

@@ -78,22 +79,22 @@ run: install start
7879
start: check-fleet
7980
# registry logger cache database (router)
8081
fleetctl --strict-host-key-checking=false start $(START_UNITS)
81-
$(call echo_yellow,"Waiting for initial services to start (this can take some time)... ")
82-
until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-registry.+(running|failed)"; do sleep 10; done
82+
$(call echo_yellow,"Waiting for deis-registry to start (this can take some time)... ")
83+
@until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-registry.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; fleetctl --strict-host-key-checking=false list-units | grep "registry" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
8384
$(call check_for_errors)
8485
$(call echo_yellow,"Done! Waiting for deis-builder...")
8586

8687
# builder
8788
fleetctl --strict-host-key-checking=false submit builder/systemd/*
8889
fleetctl --strict-host-key-checking=false start builder/systemd/*
89-
until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-builder.+(running|failed)"; do sleep 10; done
90+
@until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-builder.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; fleetctl --strict-host-key-checking=false list-units | grep "builder" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
9091
$(call check_for_errors)
9192
$(call echo_yellow,"Done! Waiting for deis-controller...")
9293

9394
# controller
9495
fleetctl --strict-host-key-checking=false submit controller/systemd/*
9596
fleetctl --strict-host-key-checking=false start controller/systemd/*
96-
until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-controller.+(running|failed)"; do sleep 10; done
97+
@until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-controller.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; fleetctl --strict-host-key-checking=false list-units | grep "controller" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
9798
$(call check_for_errors)
9899
@if [ "$$SKIP_ROUTER" = true ]; then \
99100
echo "\033[0;33mYou'll need to configure DNS and start the router manually for multi-node clusters.\033[0m" ; \

0 commit comments

Comments
 (0)