I have a nginx_proxy service that needs both nginx_1 and nginx_2 to be running if one of them is not running then the nginx_proxy will crash as it can resolve the IP of the service(s)
those are the nginx_proxy configurations:
server {
listen 80;
server_name www.app1.com;
location / {
proxy_pass http://nginx_1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_http_version 1.1;
}
}
server {
listen 80;
server_name www.app2.com;
location / {
proxy_pass http://nginx_2;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_http_version 1.1;
}
}
and this is the stack:
version: '3.9'
services:
nginx_proxy:
{...}
nginx_1:
{...}
nginx_2:
{...}
Since depends_on doesn't work in the swarm mode, and also this solution gives services.nginx.depends_on must be a list
error is there any other choices?