LemmyNet / lemmy-ansible

A docker deploy for ansible
GNU Affero General Public License v3.0
248 stars 94 forks source link

fix: nginx real-ips in logs & docker constant resolution for scaling #209

Closed ticoombs closed 7 months ago

ticoombs commented 7 months ago

Problems:

  1. nginx internal container didn't correctly display logs of client's Possibly an issue for rate_limits as well? (If rate limits are based on source ips then previously lemmy 'believes' that they are all from the same source)
  2. nginx container never refreshed the DNS of "lemmy" or "lemmy-ui". So if you added another lemmy container it would never get the IP of the new container and always send traffic to the old container(s).

Solutions:

  1. set_real_ip_from when it comes from internal docker network
  2. Set a resolver to cache for 5 seconds, and set all upstream to variables