@@ -26,15 +26,16 @@ sleep $(($ETCD_TTL+1))
2626
2727# seed initial service configuration if necessary
2828if ! etcdctl --no-sync -C $ETCD ls /deis/services > /dev/null 2>&1 ; then
29- etcdctl --no-sync -C $ETCD mkdir /deis/services || true > /dev/null 2>&1
30- etcdctl --no-sync -C $ETCD set $ETCD_PATH /port ${PORT:- 80} > /dev/null
31- etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzip on > /dev/null
32- etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipHttpVersion 1.0 > /dev/null
33- etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipCompLevel 2 > /dev/null
34- etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipProxied any > /dev/null
35- etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipVary on > /dev/null
36- etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipDisable " \" msie6\" " > /dev/null
37- etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipTypes " application/x-javascript, application/xhtml+xml, application/xml, application/xml+rss, application/json, text/css, text/javascript, text/plain, text/xml" > /dev/null
29+ etcdctl --no-sync -C $ETCD mkdir /deis/services || true > /dev/null 2>&1
30+ etcdctl --no-sync -C $ETCD mkdir /deis/domains || true > /dev/null 2>&1
31+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /port ${PORT:- 80} > /dev/null
32+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzip on > /dev/null
33+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipHttpVersion 1.0 > /dev/null
34+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipCompLevel 2 > /dev/null
35+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipProxied any > /dev/null
36+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipVary on > /dev/null
37+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipDisable " \" msie6\" " > /dev/null
38+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /gzipTypes " application/x-javascript, application/xhtml+xml, application/xml, application/xml+rss, application/json, text/css, text/javascript, text/plain, text/xml" > /dev/null
3839fi
3940
4041# wait for confd to run once and install initial templates
@@ -64,24 +65,24 @@ echo deis-router running...
6465# publish the service to etcd using the injected PORT
6566if [[ ! -z $PUBLISH ]]; then
6667
67- # configure service discovery
68- PORT=${PORT:- 80}
69- PROTO=${PROTO:- tcp}
68+ # configure service discovery
69+ PORT=${PORT:- 80}
70+ PROTO=${PROTO:- tcp}
7071
7172 set +e
7273
73- # wait for the service to become available on PUBLISH port
74- sleep 1 && while [[ -z $( netstat -lnt | awk " \$ 6 == \" LISTEN\" && \$ 4 ~ \" .$PUBLISH \" && \$ 1 ~ \" $PROTO .?\" " ) ]] ; do sleep 1; done
74+ # wait for the service to become available on PUBLISH port
75+ sleep 1 && while [[ -z $( netstat -lnt | awk " \$ 6 == \" LISTEN\" && \$ 4 ~ \" .$PUBLISH \" && \$ 1 ~ \" $PROTO .?\" " ) ]] ; do sleep 1; done
7576
76- # while the port is listening, publish to etcd
77- while [[ ! -z $( netstat -lnt | awk " \$ 6 == \" LISTEN\" && \$ 4 ~ \" .$PUBLISH \" && \$ 1 ~ \" $PROTO .?\" " ) ]] ; do
78- etcdctl --no-sync -C $ETCD set $ETCD_PATH /host $HOST --ttl $ETCD_TTL > /dev/null
79- etcdctl --no-sync -C $ETCD set $ETCD_PATH /port $PORT --ttl $ETCD_TTL > /dev/null
80- sleep $(( $ETCD_TTL / 2 )) # sleep for half the TTL
81- done
77+ # while the port is listening, publish to etcd
78+ while [[ ! -z $( netstat -lnt | awk " \$ 6 == \" LISTEN\" && \$ 4 ~ \" .$PUBLISH \" && \$ 1 ~ \" $PROTO .?\" " ) ]] ; do
79+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /host $HOST --ttl $ETCD_TTL > /dev/null
80+ etcdctl --no-sync -C $ETCD set $ETCD_PATH /port $PORT --ttl $ETCD_TTL > /dev/null
81+ sleep $(( $ETCD_TTL / 2 )) # sleep for half the TTL
82+ done
8283
83- # if the loop quits, something went wrong
84- exit 1
84+ # if the loop quits, something went wrong
85+ exit 1
8586
8687fi
8788
0 commit comments