Hi,
I'm trying to use watchtower to update my applications when I push a new image. My problem is that they are behind an nginx reverse proxy, and when the containers restart they sometimes get a new IP address. They are referred to by name in the nginx config, but it doesn't do a new lookup on each request, so I have to send it a SIGHUP.
I'm wondering if there is a way to configure watchtower send SIGHUP to my nginx container whenever it updates an image.
We're just having very similar issues, and I think if the link would work as expected (see #126), this problem would also be resolved.
I think I solved it by specifying in nginx.conf server section resolver and valid=1s
Interesting, that hadn't even come to my mind. Although I solved it differently for now, this is very valuable input. Thanks!
Some cool project https://traefik.io/
Great reverse proxy tailored for Docker.
@norpan I'm facing the same issue. Could you maybe elaborate on:
specifying in nginx.conf server section resolver and valid=1s
?
So, it's finally solved.
The two things that you need to do is to specify a resolver (which is 127.0.0.11 in docker) in your server config, and use variables in the proxy_pass to make the resolver actually resolve each time. When using variables in proxy_pass you need to create the whole new access url.
So, here is what my server section looks like:
http {
server {
resolver 127.0.0.11 valid=1s;
set $my_service my_service_name;
# Admin client
location / {
proxy_pass http://$my_service$request_uri;
}
So, it's finally solved.
The two things that you need to do is to specify a resolver (which is 127.0.0.11 in docker) in your server config, and use variables in the proxy_pass to make the resolver actually resolve each time. When using variables in proxy_pass you need to create the whole new access url.So, here is what my server section looks like:
http { server { resolver 127.0.0.11 valid=1s; set $my_service my_service_name; # Admin client location / { proxy_pass http://$my_service$request_uri; }
Thanks for the solution, @norpan ! Would you mind creating a PR updating the readme with your solution? 馃檹
Most helpful comment
So, it's finally solved.
The two things that you need to do is to specify a resolver (which is 127.0.0.11 in docker) in your server config, and use variables in the proxy_pass to make the resolver actually resolve each time. When using variables in proxy_pass you need to create the whole new access url.
So, here is what my server section looks like: