moorkop / mccy-engine

Provides a web based "Minecraft Server as a Service" (MCaaS?) to deploy Minecraft server containers on any Docker Swarm cluster or standalone Engine instance.
Apache License 2.0
12 stars 4 forks source link

Minecraft connect string should obtain IP from API, not from docker API URL. #35

Closed sshipway closed 8 years ago

sshipway commented 8 years ago

If using the unix:// API URL, then the connect string for minecraft reported in the "Current Containers" uses 'localhost'. Instead, it should use the API to query the exposed IP of the container (IP of parent Docker host) and use this, or possibly allow this string to be globally configurable.

For compatibility with docker clusters, and in situations whereservice is proxied or port-forwarded, and this IP might be different for different containers, or even different from the host IP.

itzg commented 8 years ago

I'll investigate some more, but from initial glance at the code, I attempt to pull it from the reported port mapping from the docker ps equivalent call; however, if it's reported as 0.0.0.0 I'm currently falling back to the "address" derived from dockerHostUri...which is not very useful in unix:// mode.

At a minimum I'll improve the fallback logic to allow for an ultimate override to definitively declare the "connect using" address.