V
V
Vasily Shakhunov2020-01-27 13:11:28
Nginx
Vasily Shakhunov, 2020-01-27 13:11:28

How to start nginx when there is no docker swarm service?

There is a docker swarm orchestrator and nginx inside for proxying requests.

upstream site {
  server site:3000;
}

The problem occurs when the docker swarm site service does not start or starts after the nginx service . As a result, nginx doesn't start at all because the site name doesn't resolve .
Maybe somehow you can reduce the anxiety of this setting so that nginx still starts and sends requests when the service comes to life?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Shakhunov, 2020-01-28
@inf

It looks like the only option is not to specify upstreams, but to declare them in the location directive along with the resolver.
https://ilhicas.com/2018/04/14/Nginx-Upstream-Unav...

location / {
           resolver 8.8.8.8 valid=10s;
           set $upstreamName nameofhost:8443;
           proxy_pass http://$upstreamName;

But if nginx-vts statistics are used , then upstream metrics will not be considered.
Therefore, in general, docker swarm + nginx + nginx_vts + prometheus is a road to nowhere.
As an option, try traefik as a replacement for nginx.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question