In our application we heavily depend on dockers, and use a modular approach to keep the complete application manageable and maintainable. Basically any call would go through an nginx serve which redirects (reverse proxy) the call to the correct backend.
The locations look like:
location /api/entry {
proxy_pass http://entry:1337;
}
location /api/rover {
proxy_pass http://rover:1337;
}
With entry
and rover
being the names of the (nodejs) backend dockers. This approach is important to our application as we wish to keep everything working even if a module (rover/entry) stops working for long periods of time.
The problem is, nginx seems to not wish to boot up when one of the modules is not available. (docker not started). This means that if a module is disabled for a period of time, and the nginx reboots (either due to some random reason or an update of sorts), the whole thing won't work.
I tried to fix it by adding a resolver in the location:
location /api/entry {
resolver 127.0.0.1 valid=30s;
proxy_pass http://entry:1337;
}
However even with this the server will just crash after the 30 seconds.
Another suggestion I've seen is to manually write the ip address: this is however far from what we wish to do. We actually use docker bridges because then we didn't have to care about the actual IP address, and it's "hidden" from the outside world.