docker-compose: Align hosts with hostname 86/68486/3
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 16 Sep 2019 15:18:17 +0000 (17:18 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 16 Sep 2019 15:55:59 +0000 (17:55 +0200)
When using Docker CE 19.x, `hostname -d` fails to properly resolve
the domainname due to changes in the way Docker sets it inside the
container.

Work around this issue by aligning the contents of `/etc/hostname`
with `/etc/hosts`, so `hostname -d` can properly determine the
domain name. This also requires calling `hostname -b` via cfg01
entrypoint.sh.

Change-Id: I697b5d9882e3d6641712a00bca10012800ee1898
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
mcp/scripts/.gitignore
mcp/scripts/docker-compose/files/entrypoint.sh
mcp/scripts/docker-compose/files/hosts.j2 [moved from mcp/scripts/docker-compose/files/hosts with 74% similarity]

index c21c3d9..d89d607 100644 (file)
@@ -2,3 +2,4 @@ mcp.rsa*
 user-data.sh
 xdf_data.sh
 docker-compose/files/entrypoint_maas.sh
+docker-compose/files/hosts
index 4ad1c15..baf1f65 100755 (executable)
@@ -89,6 +89,11 @@ find -L /srv/salt /srv/salt/env/prd/_* -maxdepth 1 -type l -delete
 # Fix up any permissions after above file shuffling
 chown root:root -R /srv/salt
 
+# Docker-ce 19.x+ workaround for broken domainname setup
+# shellcheck source=/dev/null
+source /root/fuel/mcp/scripts/xdf_data.sh
+hostname -b "cfg01.${CLUSTER_DOMAIN}"
+
 service ssh start
 service salt-minion start
 
similarity index 74%
rename from mcp/scripts/docker-compose/files/hosts
rename to mcp/scripts/docker-compose/files/hosts.j2
index 4731841..b42c5a0 100644 (file)
@@ -1,3 +1,4 @@
+{{ conf.SALT_MASTER }} cfg01.{{ conf.cluster.domain }}
 127.0.0.1 localhost
 ::1       localhost ip6-localhost ip6-loopback
 fe00::0   ip6-localnet