diff --git a/loadbalancer/templates/nginx.conf.conf b/loadbalancer/templates/nginx.conf.conf index c21d81a3..49f23cdf 100644 --- a/loadbalancer/templates/nginx.conf.conf +++ b/loadbalancer/templates/nginx.conf.conf @@ -74,10 +74,6 @@ http { server ${INTERNAL_DOMAIN}:5117; } - upstream grafana { - server monitoring_grafana:3000; - } - server { listen 80 default_server; server_name ${TEST_DOMAIN}; @@ -154,15 +150,21 @@ http { } location /grafana/ { - proxy_pass http://grafana; + resolver 127.0.0.11; # Docker DNS resolver + # We use a variable here to avoid Nginx crashing for when the container isn't running + set $upstream http://monitoring_grafana:3000; + proxy_pass $upstream; } # Proxy Grafana Live WebSocket connections. location /grafana/api/live/ { + resolver 127.0.0.11; # Docker DNS resolver + # We use a variable here to avoid Nginx crashing for when the container isn't running + set $upstream http://monitoring_grafana:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; - proxy_pass http://grafana; + proxy_pass $upstream; } } }