Skip to content

Commit

Permalink
Merge pull request #4487 from johscheuer/docker-add-support-multiple-…
Browse files Browse the repository at this point in the history
…hostnames

Use only one IP address that matches the hostname
  • Loading branch information
alecgrieser committed Apr 13, 2021
2 parents f02c352 + 5259721 commit 7a1133f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions packaging/docker/create_server_environment.bash
Expand Up @@ -23,21 +23,18 @@
source /var/fdb/scripts/create_cluster_file.bash

function create_server_environment() {
fdb_dir=/var/fdb
env_file=$fdb_dir/.fdbenv

: > $env_file
env_file=/var/fdb/.fdbenv

if [[ "$FDB_NETWORKING_MODE" == "host" ]]; then
public_ip=127.0.0.1
elif [[ "$FDB_NETWORKING_MODE" == "container" ]]; then
public_ip=$(grep `hostname` /etc/hosts | sed -e "s/\s *`hostname`.*//")
public_ip=$(hostname -i | awk '{print $1}')
else
echo "Unknown FDB Networking mode \"$FDB_NETWORKING_MODE\"" 1>&2
exit 1
fi

echo "export PUBLIC_IP=$public_ip" >> $env_file
echo "export PUBLIC_IP=$public_ip" > $env_file
if [[ -z $FDB_COORDINATOR && -z "$FDB_CLUSTER_FILE_CONTENTS" ]]; then
FDB_CLUSTER_FILE_CONTENTS="docker:docker@$public_ip:$FDB_PORT"
fi
Expand Down
2 changes: 1 addition & 1 deletion packaging/docker/fdb.bash
Expand Up @@ -26,4 +26,4 @@ source /var/fdb/.fdbenv
echo "Starting FDB server on $PUBLIC_IP:$FDB_PORT"
fdbserver --listen_address 0.0.0.0:$FDB_PORT --public_address $PUBLIC_IP:$FDB_PORT \
--datadir /var/fdb/data --logdir /var/fdb/logs \
--locality_zoneid=`hostname` --locality_machineid=`hostname` --class $FDB_PROCESS_CLASS
--locality_zoneid="$(hostname)" --locality_machineid="$(hostname)" --class $FDB_PROCESS_CLASS

0 comments on commit 7a1133f

Please sign in to comment.