Skip to content

Commit 57078a4

Browse files
committed
feat(controller/coreos.py) Adding TimeoutStartSec to log and announce services
Sometimes log and announce services fail to start because they depend on the main service, but if it takes too long they fail because of timeout. This commit just adds the same timeout to log and announce services than the main service has.
1 parent fc906e7 commit 57078a4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

controller/scheduler/coreos.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def attach(self, name):
239239
ExecStartPre=/bin/sh -c "until docker inspect -f '{{{{range $i, $e := .HostConfig.PortBindings }}}}{{{{$p := index $e 0}}}}{{{{$p.HostPort}}}}{{{{end}}}}' {name} >/dev/null 2>&1; do sleep 2; done; port=$(docker inspect -f '{{{{range $i, $e := .HostConfig.PortBindings }}}}{{{{$p := index $e 0}}}}{{{{$p.HostPort}}}}{{{{end}}}}' {name}); if [[ -z $port ]]; then echo We have no port...; exit 1; fi; echo Waiting for $port/tcp...; until netstat -lnt | grep :$port >/dev/null; do sleep 1; done"
240240
ExecStart=/bin/sh -c "port=$(docker inspect -f '{{{{range $i, $e := .HostConfig.PortBindings }}}}{{{{$p := index $e 0}}}}{{{{$p.HostPort}}}}{{{{end}}}}' {name}); echo Connected to $COREOS_PRIVATE_IPV4:$port/tcp, publishing to etcd...; while netstat -lnt | grep :$port >/dev/null; do etcdctl set /deis/services/{app}/{name} $COREOS_PRIVATE_IPV4:$port --ttl 60 >/dev/null; sleep 45; done"
241241
ExecStop=/usr/bin/etcdctl rm --recursive /deis/services/{app}/{name}
242+
TimeoutStartSec=20m
242243
243244
[X-Fleet]
244245
X-ConditionMachineOf={name}.service
@@ -252,6 +253,7 @@ def attach(self, name):
252253
[Service]
253254
ExecStartPre=/bin/sh -c "until docker inspect {name} >/dev/null 2>&1; do sleep 1; done"
254255
ExecStart=/bin/sh -c "docker logs -f {name} 2>&1 | logger -p local0.info -t {app}[{c_type}.{c_num}] --udp --server $(etcdctl get /deis/logs/host | cut -d ':' -f1) --port $(etcdctl get /deis/logs/port | cut -d ':' -f2)"
256+
TimeoutStartSec=20m
255257
256258
[X-Fleet]
257259
X-ConditionMachineOf={name}.service

0 commit comments

Comments
 (0)