Fix docker static dns
https://gitlab.e.foundation/e/infra/b2b/infrastructure-base/-/issues/14
I updated the Nginx PHP handler to use a dynamic target instead of a static address. With set $php_upstream "${NEXTCLOUD_ADDR}"; and fastcgi_pass $php_upstream;, Nginx now relies on the Docker DNS resolver (resolver 127.0.0.11 valid=5s;). This means it automatically picks up the new IP of the PHP container whenever it changes, solving the issue we had with hard-coded IPs.
on this scenario we have nc1 without the fix and nc3 with the fix
I restarted the nextcloud container on both instances, nc1 couldn't reach the container after the restart instead of nc3
root@dev-manager ~ # docker service scale nc1_nextcloud=0
nc1_nextcloud scaled to 0
overall progress: 0 out of 0 tasks
verify: Service nc1_nextcloud converged
root@dev-manager ~ # docker service scale nc3_nextcloud=0
nc3_nextcloud scaled to 0
overall progress: 0 out of 0 tasks
verify: Service nc3_nextcloud converged
root@dev-manager ~ # docker service scale nc1_nextcloud=1
nc1_nextcloud scaled to 1
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service nc1_nextcloud converged
root@dev-manager ~ # docker service scale nc3_nextcloud=1
nc3_nextcloud scaled to 1
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service nc3_nextcloud converged
Edited by Thomas G.
