mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 22:02:28 +00:00
[es] Also adding host IP discovery for http
This commit is contained in:
parent
8cea619c13
commit
c38bfb22cc
2 changed files with 17 additions and 4 deletions
|
@ -170,7 +170,7 @@ Using the Docker Compose file above, a value of `2` is appropriate when scaling
|
|||
|
||||
docker-compose scale master=3
|
||||
|
||||
## Auto transport discovery with Swarm Mode
|
||||
## Auto transport/http discovery with Swarm Mode
|
||||
|
||||
When using Docker Swarm mode (starting with 1.12), the overlay and ingress network interfaces are assigned
|
||||
multiple IP addresses. As a result, it creates confusion for the transport publish logic even when using
|
||||
|
@ -181,3 +181,7 @@ To resolve this, add
|
|||
-e DISCOVER_TRANSPORT_IP=eth0
|
||||
|
||||
replacing `eth0` with another interface within the container, if needed.
|
||||
|
||||
The same can be done for publish/binding of the http module by adding:
|
||||
|
||||
-e DISCOVERY_HTTP_IP=eth2
|
||||
|
|
|
@ -18,10 +18,19 @@ OPTS="$OPTS -Des.path.conf=/conf \
|
|||
-Des.transport.tcp.port=9300 \
|
||||
-Des.http.port=9200"
|
||||
|
||||
discoverIpFromLink() {
|
||||
dev=$1
|
||||
mode=$2
|
||||
ip=`ipaddr show dev $dev scope global|awk '$1 == "inet" { if (!match($2,"/32")) { gsub("/.*","",$2) ; print $2 } }'`
|
||||
echo "Discovered $mode address $ip for $dev"
|
||||
OPTS="$OPTS -Des.$mode.host=$ip"
|
||||
}
|
||||
|
||||
if [ "$DISCOVER_TRANSPORT_IP" != "" ]; then
|
||||
ip=`ipaddr show dev $DISCOVER_TRANSPORT_IP scope global|awk '$1 == "inet" { if (!match($2,"/32")) { gsub("/.*","",$2) ; print $2 } }'`
|
||||
echo "Discovered address $ip for $DISCOVER_TRANSPORT_IP"
|
||||
OPTS="$OPTS -Des.transport.host=$ip"
|
||||
discoverIpFromLink $DISCOVER_TRANSPORT_IP transport
|
||||
fi
|
||||
if [ "$DISCOVER_HTTP_IP" != "" ]; then
|
||||
discoverIpFromLink $DISCOVER_HTTP_IP http
|
||||
fi
|
||||
|
||||
if [ -n "$CLUSTER" ]; then
|
||||
|
|
Loading…
Reference in a new issue