Skip to content

Commit b493ad9

Browse files
committed
fix(builder): start after controller, block until running
deis-builder was reporting as running very quickly, but inside the container slugrunner and slugbuilder were taking many minutes to make the container actually active. Here, we add an ExecStartPost to block a 'running' status until we're listening on 2222. We also start the controller before builder, as builder checks for /deis/controller. fixes #857
1 parent c34b6ac commit b493ad9

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

Makefile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,27 @@ restart: stop start
7777
run: install start
7878

7979
start: check-fleet
80-
# registry logger cache database (router)
80+
@# registry logger cache database (router)
81+
$(call echo_yellow,"Starting Deis! Deis will be functional once all services are reported as running... ")
8182
fleetctl --strict-host-key-checking=false start $(START_UNITS)
8283
$(call echo_yellow,"Waiting for deis-registry to start (this can take some time)... ")
8384
@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
8485
$(call check_for_errors)
85-
$(call echo_yellow,"Done! Waiting for deis-builder...")
8686

87-
# builder
88-
fleetctl --strict-host-key-checking=false submit builder/systemd/*
89-
fleetctl --strict-host-key-checking=false start builder/systemd/*
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
91-
$(call check_for_errors)
87+
@# controller
9288
$(call echo_yellow,"Done! Waiting for deis-controller...")
93-
94-
# controller
9589
fleetctl --strict-host-key-checking=false submit controller/systemd/*
9690
fleetctl --strict-host-key-checking=false start controller/systemd/*
9791
@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
92+
93+
@# builder
94+
$(call echo_yellow,"Done! Waiting for deis-builder to start (this can also take some time)... ")
95+
fleetctl --strict-host-key-checking=false submit builder/systemd/*
96+
fleetctl --strict-host-key-checking=false start builder/systemd/*
97+
@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
9898
$(call check_for_errors)
99+
100+
@# router
99101
@if [ "$$SKIP_ROUTER" = true ]; then \
100102
echo "\033[0;33mYou'll need to configure DNS and start the router manually for multi-node clusters.\033[0m" ; \
101103
echo "\033[0;33mRun 'make start-router' to schedule and start deis-router.\033[0m" ; \
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
[Unit]
22
Description=deis-builder
3+
Requires=deis-controller.service
4+
After=deis-controller.service
35

46
[Service]
57
EnvironmentFile=/etc/environment
68
TimeoutStartSec=20m
79
ExecStartPre=/bin/sh -c "/usr/bin/docker history deis/builder >/dev/null || /usr/bin/docker pull deis/builder"
810
ExecStartPre=/bin/bash -c "/usr/bin/docker start deis-builder-data || /usr/bin/docker run --name deis-builder-data -v /var/lib/docker deis/base /bin/true"
911
ExecStart=/bin/sh -c "docker run --name deis-builder -p 2222:22 -e PUBLISH=22 -e HOST=$COREOS_PRIVATE_IPV4 -e PORT=2222 --volumes-from deis-builder-data --privileged deis/builder"
12+
ExecStartPost=/bin/sh -c "echo 'Waiting for builder on 2222/tcp...' && until cat </dev/null>/dev/tcp/$COREOS_PRIVATE_IPV4/2222; do sleep 1; done"
1013
ExecStop=/usr/bin/docker rm -f deis-builder
1114

1215
[Install]
1316
WantedBy=multi-user.target
1417

15-
# We only need this so that when we start controller, it's guaranteed to be scheduled
16-
# (If logger and builder are on separate machines, controller can never be scheduled)
1718
[X-Fleet]
18-
X-ConditionMachineOf=deis-logger.service
19+
X-ConditionMachineOf=deis-controller.service

controller/systemd/deis-controller.service

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Unit]
22
Description=deis-controller
3-
Requires=deis-logger.service deis-builder.service
4-
After=deis-logger.service deis-builder.service
3+
Requires=deis-logger.service
4+
After=deis-logger.service
55

66
[Service]
77
EnvironmentFile=/etc/environment
@@ -15,4 +15,3 @@ WantedBy=multi-user.target
1515

1616
[X-Fleet]
1717
X-ConditionMachineOf=deis-logger.service
18-
X-ConditionMachineOf=deis-builder.service

0 commit comments

Comments
 (0)