ContainerSolutions / mesos-starter

https://container-solutions.com/mesos-starter/
45 stars 10 forks source link

Enhancement/29 port resources #33

Closed philwinder closed 8 years ago

philwinder commented 8 years ago

Working port injection. …

Working host example:

spring.application.name=kibana
mesos.framework.name=kibana
mesos.resources.scale=3
mesos.resources.cpus=0.5
mesos.resources.mem=256
mesos.command=kibana --port=$UI_5061 --elasticsearch http://172.17.0.2:9200
mesos.resources.ports=true
mesos.resources.ports.UI_5061=ANY
mesos.docker.network=HOST
mesos.docker.image=kibana:latest

Working bridge example:

spring.application.name=kibana
mesos.framework.name=kibana
mesos.resources.scale=3
mesos.resources.cpus=0.5
mesos.resources.mem=256
mesos.command=kibana --port=$UI_5061 --elasticsearch http://172.17.0.2:9200
mesos.resources.ports=true
mesos.resources.ports.UI_5061=ANY
mesos.docker.parameter.expose=$UI_5061
mesos.docker.network=BRIDGE
mesos.docker.image=kibana:latest

Working jar mode:

spring.application.name=kibana
mesos.framework.name=kibana
mesos.resources.scale=3
mesos.resources.cpus=0.5
mesos.resources.mem=256
mesos.command=curl -sS -q -o kibana.tar.gz https://download.elastic.co/kibana/kibana/kibana-4.4.1-linux-x64.tar.gz > /dev/null ; tar -zxf kibana.tar.gz ; cd kibana-* ; bin/kibana --port=$UI_5061 --elasticsearch http://172.17.0.2:9200
mesos.resources.ports=true
mesos.resources.ports.UI_5061=ANY

Fixes #27 and #29

mwl commented 8 years ago

@philwinder Looks like there's a merge conflict with Master

philwinder commented 8 years ago

There is a problem with this line: https://github.com/ContainerSolutions/mesos-starter/blob/master/spring-boot-starter-mesos/src/main/java/com/containersolutions/mesos/config/autoconfigure/MesosSchedulerConfiguration.java#L169

A map isn't considered to be a present property. So when a user applies a port requirement, the port requirement isn't instantiated.

mwl commented 8 years ago

Didn't you rename it to plural ports?

mwl commented 8 years ago

Working bridge example:

spring.application.name=kibana mesos.framework.name=kibana mesos.resources.scale=3 mesos.resources.cpus=0.5 mesos.resources.mem=256 mesos.command=kibana --port=$UI_5061 --elasticsearch http://172.17.0.2:9200 mesos.resources.ports=true mesos.resources.ports.UI_5061=ANY mesos.docker.parameter.expose=$UI_5061 mesos.docker.network=BRIDGE mesos.docker.image=kibana:latest

Documentation seems wrong? Value of $UI_5061 is the port from the Mesos Resources (i.e. 31000). To me it makes no sense to start Kibana on that port, and expose it when in Bridge mode. Normally you never touch the container ports when in Bridge mode. You just map them to $UI_5061 on the host.

mwl commented 8 years ago

Solved in #39