Skip to content

Commit 97e6e42

Browse files
committed
Merge pull request #831 from deis/makefile_friendly_loop
fix(Makefile): 'make run' starts Deis in one shot
2 parents 39f91c1 + a4da57d commit 97e6e42

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

Makefile

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ define ssh_all
1919
done
2020
endef
2121

22+
define check_for_errors
23+
@if fleetctl --strict-host-key-checking=false list-units|grep -q "failed"; then \
24+
echo "\033[0;31mOne or more services failed! Check which services by running 'make status'\033[0m" ; \
25+
echo "\033[0;31mYou can get detailed output with 'fleetctl status deis-servicename.service'\033[0m" ; \
26+
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+
fi
28+
endef
29+
2230
define echo_yellow
2331
@echo "\033[0;33m$(subst ",,$(1))\033[0m"
2432
endef
@@ -45,7 +53,7 @@ build:
4553

4654
check-fleet:
4755
@LOCAL_VERSION=`fleetctl -version`; \
48-
REMOTE_VERSION=`ssh core@$(FLEETCTL_TUNNEL) fleetctl -version`; \
56+
REMOTE_VERSION=`ssh -o StrictHostKeyChecking=no core@$(FLEETCTL_TUNNEL) fleetctl -version`; \
4957
if [ "$$LOCAL_VERSION" != "$$REMOTE_VERSION" ]; then \
5058
echo "Your fleetctl client version should match the server. Local version: $$LOCAL_VERSION, server version: $$REMOTE_VERSION. Uninstall your local version and install the latest build from https://github.com/coreos/fleet/releases"; exit 1; \
5159
fi
@@ -68,25 +76,30 @@ restart: stop start
6876
run: install start
6977

7078
start: check-fleet
79+
# registry logger cache database (router)
7180
fleetctl --strict-host-key-checking=false start $(START_UNITS)
72-
$(call echo_yellow,"Use 'make status' to monitor these services")
73-
$(call echo_yellow,"Run 'make start-builder' to continue once all are running")
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
83+
$(call check_for_errors)
84+
$(call echo_yellow,"Done! Waiting for deis-builder...")
7485

75-
start-builder: check-fleet
86+
# builder
7687
fleetctl --strict-host-key-checking=false submit builder/systemd/*
7788
fleetctl --strict-host-key-checking=false start builder/systemd/*
78-
$(call echo_yellow,"Use 'make status' to monitor the service")
79-
$(call echo_yellow,"Run 'make start-controller' to continue once the service is running")
89+
until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-builder.+(running|failed)"; do sleep 10; done
90+
$(call check_for_errors)
91+
$(call echo_yellow,"Done! Waiting for deis-controller...")
8092

81-
start-controller: check-fleet
93+
# controller
8294
fleetctl --strict-host-key-checking=false submit controller/systemd/*
8395
fleetctl --strict-host-key-checking=false start controller/systemd/*
84-
$(call echo_yellow,"Use 'make status' to monitor the service")
96+
until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-controller.+(running|failed)"; do sleep 10; done
97+
$(call check_for_errors)
8598
@if [ "$$SKIP_ROUTER" = true ]; then \
8699
echo "\033[0;33mYou'll need to configure DNS and start the router manually for multi-node clusters.\033[0m" ; \
87100
echo "\033[0;33mRun 'make start-router' to schedule and start deis-router.\033[0m" ; \
88101
else \
89-
echo "\033[0;33mYour Deis cluster is ready to go once the controller is live! Follow the README to login and use Deis.\033[0m" ; \
102+
echo "\033[0;33mYour Deis cluster is ready to go! Follow the README to login and use Deis.\033[0m" ; \
90103
fi
91104

92105
start-router: check-fleet

0 commit comments

Comments
 (0)