fix: keep web services up during API rollout
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user