Always choose the default IPv4 address for init'ing

Closes coop-cloud/abra#91.
This commit is contained in:
decentral1se
2021-03-10 22:23:38 +01:00
parent 040374e781
commit 3276c9fe47
2 changed files with 11 additions and 2 deletions

12
abra
View File

@ -1509,7 +1509,10 @@ sub_server_list() {
help_server_init (){
echo "abra [options] server init
Set up a server for Docker swarm joy.
Set up a server for Docker swarm joy. This initialisation explicitly chooses
for the \"single host swarm\" mode which uses the default IPv4 address as the
advertising address. This can be re-configured later for more advanced use
cases.
POWERED BY
docker swarm init
@ -1521,7 +1524,12 @@ sub_server_init() {
load_context
docker swarm init || true
# Note(decentral1se): it sucks to use Google DNS but seems like a reliable method
# for determining the default IPv4 address especially nowadays
# when there are often multiple internal addresses assigned to eth0
default_ipv4="$(ip route get 8.8.8.8 | head -1 | awk '{print $7}')"
docker swarm init --advertise-addr "$default_ipv4" || true
docker network create --driver=overlay proxy --scope swarm || true
}