Skip to content

Commit 9faf9fa

Browse files
chore(*): Rename PUBLISH to EXTERNAL_PORT
This makes the boot logic more understandable. This commit also fixes some wrong comments, about what is published and what is checked.
1 parent e8aa998 commit 9faf9fa

16 files changed

Lines changed: 37 additions & 37 deletions

File tree

builder/bin/boot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,22 @@ trap on_exit INT TERM EXIT
8080

8181
echo deis-builder running...
8282

83-
# publish the service to etcd using the injected PORT
84-
if [[ ! -z $PUBLISH ]]; then
83+
# publish the service to etcd using the injected EXTERNAL_PORT
84+
if [[ ! -z $EXTERNAL_PORT ]]; then
8585

8686
# configure service discovery
8787
PORT=${PORT:-22}
8888
PROTO=${PROTO:-tcp}
8989

9090
set +e
9191

92-
# wait for the service to become available on PUBLISH port
92+
# wait for the service to become available on PORT
9393
sleep 1 && while [[ -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do sleep 1; done
9494

9595
# while the port is listening, publish to etcd
9696
while [[ ! -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do
9797
etcdctl --no-sync -C $ETCD set $ETCD_PATH/host $HOST --ttl $ETCD_TTL >/dev/null
98-
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $PUBLISH --ttl $ETCD_TTL >/dev/null
98+
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $EXTERNAL_PORT --ttl $ETCD_TTL >/dev/null
9999
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
100100
done
101101

builder/tests/builder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestBuilder(t *testing.T) {
5252
"-e", "STORAGE_DRIVER=aufs",
5353
"-e", "HOST="+host,
5454
"-e", "ETCD_PORT="+etcdPort,
55-
"-e", "PUBLISH="+port,
55+
"-e", "EXTERNAL_PORT="+port,
5656
"--privileged", "deis/builder:"+tag)
5757
}()
5858
dockercli.PrintToStdout(t, stdout, stdoutPipe, "deis-builder running")

cache/bin/boot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,22 @@ trap on_exit INT TERM
4545

4646
echo deis-cache running...
4747

48-
# publish the service to etcd using the injected PORT
49-
if [[ ! -z $PUBLISH ]]; then
48+
# publish the service to etcd using the injected EXTERNAL_PORT
49+
if [[ ! -z $EXTERNAL_PORT ]]; then
5050

5151
# configure service discovery
5252
PORT=${PORT:-6379}
5353
PROTO=${PROTO:-tcp}
5454

5555
set +e
5656

57-
# wait for the service to become available on PUBLISH port
57+
# wait for the service to become available on PORT
5858
sleep 1 && while [[ -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do sleep 1; done
5959

6060
# while the port is listening, publish to etcd
6161
while [[ ! -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do
6262
etcdctl --no-sync -C $ETCD set $ETCD_PATH/host $HOST --ttl $ETCD_TTL >/dev/null
63-
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $PUBLISH --ttl $ETCD_TTL >/dev/null
63+
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $EXTERNAL_PORT --ttl $ETCD_TTL >/dev/null
6464
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
6565
done
6666

cache/systemd/deis-cache.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ EnvironmentFile=/etc/environment
66
TimeoutStartSec=20m
77
ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/cache`; docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE"
88
ExecStartPre=/bin/sh -c "docker inspect deis-cache >/dev/null 2>&1 && docker rm -f deis-cache || true"
9-
ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/cache` && docker run --name deis-cache --rm -p 6379:6379 -e PUBLISH=6379 -e HOST=$COREOS_PRIVATE_IPV4 $IMAGE"
9+
ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/cache` && docker run --name deis-cache --rm -p 6379:6379 -e EXTERNAL_PORT=6379 -e HOST=$COREOS_PRIVATE_IPV4 $IMAGE"
1010
ExecStopPost=/usr/bin/docker stop deis-cache
1111

1212
[Install]

cache/tests/cache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestCache(t *testing.T) {
2828
"--name", name,
2929
"--rm",
3030
"-p", port+":6379",
31-
"-e", "PUBLISH="+port,
31+
"-e", "EXTERNAL_PORT="+port,
3232
"-e", "HOST="+host,
3333
"-e", "ETCD_PORT="+etcdPort,
3434
"deis/cache:"+tag)

controller/bin/boot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,22 @@ CONFD_PID=$!
7272

7373
echo deis-controller running...
7474

75-
# publish the service to etcd using the injected PORT
76-
if [[ ! -z $PUBLISH ]]; then
75+
# publish the service to etcd using the injected EXTERNAL_PORT
76+
if [[ ! -z $EXTERNAL_PORT ]]; then
7777

7878
# configure service discovery
7979
PORT=${PORT:-8000}
8080
PROTO=${PROTO:-tcp}
8181

8282
set +e
8383

84-
# wait for the service to become available on PUBLISH port
84+
# wait for the service to become available on PORT
8585
sleep 1 && while [[ -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do sleep 1; done
8686

8787
# while the port is listening, publish to etcd
8888
while [[ ! -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do
8989
etcdctl --no-sync -C $ETCD set $ETCD_PATH/host $HOST --ttl $ETCD_TTL >/dev/null
90-
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $PUBLISH --ttl $ETCD_TTL >/dev/null
90+
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $EXTERNAL_PORT --ttl $ETCD_TTL >/dev/null
9191
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
9292
done
9393

controller/tests/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestController(t *testing.T) {
4646
"--name", name,
4747
"--rm",
4848
"-p", port+":8000",
49-
"-e", "PUBLISH="+port,
49+
"-e", "EXTERNAL_PORT="+port,
5050
"-e", "HOST="+host,
5151
"-e", "ETCD_PORT="+etcdPort,
5252
"deis/controller:"+tag)

database/bin/boot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,22 @@ sleep 1 && while [[ -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".5432\
7575

7676
echo deis-database running...
7777

78-
# publish the service to etcd using the injected HOST and PORT
79-
if [[ ! -z $PUBLISH ]]; then
78+
# publish the service to etcd using the injected HOST and EXTERNAL_PORT
79+
if [[ ! -z $EXTERNAL_PORT ]]; then
8080

8181
# configure service discovery
8282
PORT=${PORT:-5432}
8383
PROTO=${PROTO:-tcp}
8484

8585
set +e
8686

87-
# wait for the service to become available on PUBLISH port
87+
# wait for the service to become available on PORT
8888
sleep 1 && while [[ -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do sleep 1; done
8989

9090
# while the port is listening, publish to etcd
9191
while [[ ! -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do
9292
etcdctl --no-sync -C $ETCD set $ETCD_PATH/host $HOST --ttl $ETCD_TTL >/dev/null
93-
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $PUBLISH --ttl $ETCD_TTL >/dev/null
93+
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $EXTERNAL_PORT --ttl $ETCD_TTL >/dev/null
9494
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
9595
done
9696

database/tests/database_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestDatabase(t *testing.T) {
2929
"--name", name,
3030
"--rm",
3131
"-p", port+":5432",
32-
"-e", "PUBLISH="+port,
32+
"-e", "EXTERNAL_PORT="+port,
3333
"-e", "HOST="+host,
3434
"-e", "ETCD_PORT="+etcdPort,
3535
"--volumes-from", "deis-database-data",

logger/bin/boot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ trap on_exit INT TERM
3232

3333
echo deis-logger running...
3434

35-
# publish the service to etcd using the injected PORT
36-
if [[ ! -z $PUBLISH ]]; then
35+
# publish the service to etcd using the injected EXTERNAL_PORT
36+
if [[ ! -z $EXTERNAL_PORT ]]; then
3737

3838
# configure service discovery
3939
PORT=${PORT:-514}
4040
PROTO=${PROTO:-udp}
4141

4242
set +e
4343

44-
# wait for the service to become available on PUBLISH port
44+
# wait for the service to become available on PORT
4545
sleep 1 && while [[ -z $(netstat -lnu | awk "\$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do sleep 1; done
4646

4747
# while the port is listening, publish to etcd
4848
while [[ ! -z $(netstat -lnu | awk "\$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do
4949
etcdctl -C $ETCD set --ttl $ETCD_TTL $ETCD_PATH/host $HOST --no-sync >/dev/null
50-
etcdctl -C $ETCD set --ttl $ETCD_TTL $ETCD_PATH/port $PUBLISH --no-sync >/dev/null
50+
etcdctl -C $ETCD set --ttl $ETCD_TTL $ETCD_PATH/port $EXTERNAL_PORT --no-sync >/dev/null
5151
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
5252
done
5353

0 commit comments

Comments
 (0)