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
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A
2 changed files with 11 additions and 2 deletions

View File

@ -8,6 +8,7 @@
- Allow cloning of app repos with different main branches using `-b, --branch=<branch>` ([#80](https://git.autonomic.zone/coop-cloud/abra/issues/80))
- Protect against lengthy app names which gives Docker trouble later on ([#83](https://git.autonomic.zone/coop-cloud/abra/issues/83))
- Support removal of secrets and volumes when `rm`'ing apps ([#44](https://git.autonomic.zone/coop-cloud/abra/issues/44))
- Always choose the default IPv4 address with `abra server <host> init` ([#91](https://git.autonomic.zone/coop-cloud/abra/issues/91))
# abra 0.5.0 (2021-03-01)

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
}