From fbb620bd857cf80d112dc3f90f2b1ebf3415ccb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Fri, 18 Sep 2026 12:17:34 -0300 Subject: [PATCH] fix: keep web services up during API rollout --- deploy/nginx.conf.template | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deploy/nginx.conf.template b/deploy/nginx.conf.template index 464cf1b..c84e6e4 100644 --- a/deploy/nginx.conf.template +++ b/deploy/nginx.conf.template @@ -3,6 +3,11 @@ server { listen 8080; server_name ${PUBLIC_HOST}; if ($host != ${PUBLIC_HOST}) { return 400; } + # Resolve through Docker's embedded DNS at request time. This prevents + # Nginx from exiting during a Swarm rollout when the API task is briefly + # unavailable or still creating its database schema. + resolver 127.0.0.11 ipv6=off valid=10s; + set $api_upstream api:8000; root /usr/share/nginx/html; index ${WEB_INDEX}; @@ -17,7 +22,7 @@ server { location /api/ { limit_req zone=api_limit burst=100 nodelay; limit_req_status 429; - proxy_pass http://api:8000; + proxy_pass http://$api_upstream; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host;