Skip to content

Commit 365314f

Browse files
author
Matthew Fisher
committed
chore(controller): remove $PORT logic from fleet
For buildpack apps, [$PORT is exposed][1] as part of slugrunner's job. For Dockerfile/Docker images, the internal port numbers are already known to the developer, so if they want to follow 12-factor best practices then they will have set up $PORT in their own image. deis/publisher exposes the port with the lowest numerical value to the router, which is why the documentation is reflected to show this. https://github.com/deis/deis/blob/e6a078b4119887b4de73e8a6d04291b7cdeb823b/builder/image/slugrunner/Dockerfile#L10-L12
1 parent 71fe9b6 commit 365314f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scheduler/fleet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def attach(self, name):
379379
{"section": "Unit", "name": "Description", "value": "{name}"},
380380
{"section": "Service", "name": "ExecStartPre", "value": '''/bin/sh -c "IMAGE=$(etcdctl get /deis/registry/host 2>&1):$(etcdctl get /deis/registry/port 2>&1)/{image}; docker pull $IMAGE"'''}, # noqa
381381
{"section": "Service", "name": "ExecStartPre", "value": '''/bin/sh -c "docker inspect {name} >/dev/null 2>&1 && docker rm -f {name} || true"'''}, # noqa
382-
{"section": "Service", "name": "ExecStart", "value": '''/bin/sh -c "IMAGE=$(etcdctl get /deis/registry/host 2>&1):$(etcdctl get /deis/registry/port 2>&1)/{image}; port=$(docker inspect -f '{{{{range $k, $v := .ContainerConfig.ExposedPorts }}}}{{{{$k}}}}{{{{end}}}}' $IMAGE | cut -d/ -f1) ; docker run --name {name} {memory} {cpu} {hostname} -P -e PORT=$port $IMAGE {command}"'''}, # noqa
382+
{"section": "Service", "name": "ExecStart", "value": '''/bin/sh -c "IMAGE=$(etcdctl get /deis/registry/host 2>&1):$(etcdctl get /deis/registry/port 2>&1)/{image}; docker run --name {name} {memory} {cpu} {hostname} -P $IMAGE {command}"'''}, # noqa
383383
{"section": "Service", "name": "ExecStop", "value": '''/usr/bin/docker stop {name}'''},
384384
{"section": "Service", "name": "ExecStop", "value": '''/usr/bin/docker rm -f {name}'''},
385385
{"section": "Service", "name": "TimeoutStartSec", "value": "20m"},

0 commit comments

Comments
 (0)